Error "Cannot Resolve symbol R" - android-studio-2.1

This problem has been addressed hundreds of times here but I haven't still solved it.
I have tried everything available on Stack Overflow and everywhere else:
Build -> Clean Project; Build -> Rebuild Project
Tools -> Android -> Sync Project with Gradle files
Update SDK Manager (it wasn't updated)
Add import android.R and import android.R.*
But now I don't know what to do.

(Posted on behalf of the OP).
I had to update to buildToolsVersion "21.1.2".

Related

Crashlytics could not find the resource file generated by Google Services

Crashlytics could not find the resource file generated by Google Services.You may need to execute the :processGoogleServices Task
i read the solution from this qusetion Crashlytics could not find the resource file generated by Google Services. You may need to execute the :process<Variant>GoogleServices Task
but i didn't succeded to run this command in my unity project
./gradlew :app:processProdReleaseGoogleServices or ./gradlew :app:processDevReleaseGoogleServices
how can i run it?
A tricky bit with the Unity SDK is that because Firebase still supports versions of Unity that predate a total move to gradle (I believe 2019.4 is when Unity switched over entirely, the earliest supported version right now is 2017.4), many Android specific solutions (such as the one you linked) won't function. If you did want to try it, you can select "Export Project" in your build settings -- but I don't think this will help:
It sounds instead like you're missing Plugins/Android/FirebaseApp.androidlib or Plugins/Android/FirebaseCrashlytics.androidlib. These are generated by the Firebase plugins (obviously FirebaseCrashlytics.androidlib is specific to Crashlytics -- you won't see that one otherwise) as part of a processing step to simulate what the Play Services gradle plugin would do in a typical Android application or game.
Some things to try:
Make sure you're on a supported version of Unity (2017.4 or newer -- Firebase does not officially support alphas or betas).
Ensure that you have a valid google-services.json file added and that Crashlytics has been added to your backend (full instructions here to redownload).
Re-add FirebaseCrashlytics and ensure that you leave everything checked.
Ensure that you have the latest Crashlytics plugin (currently 7.1.0). You can download just Crashlytics now from this site, but make sure you don't mix and match versions with other Firebase plugins.
And if none of these work, sometimes small changes in build environments expose unexpected issues. Your best bet will be to file an issue here with everything you've tried.

Unity and Firebase - Package Manager Resolver, uninstalling the following packages: Firebase Authentication

I'm using Unity 2019.3.4f1 and Firebase Package 6.15.2 and when I import the Custom Package the Package Manager Resolver asks to change the "/manifest.json".
When I click "Add Selected Registries", Unity starts to Uninstall the packages and stay on its hours with this message: "Uninstalling the following packages: Firebase Authentication"
Package Manager Resolver
I can't deploy or play the game without this message appears.
What you're running into is that newer versions of Unity support a package manager that makes it easier to install and manage dependencies. Newer versions of the Firebase SDK can optionally take advantage of this.
I can't quite tell what your specific issue is, but there are a couple routes forward.
The simplest is to just click "Disable Registry Edition." If you don't feel like messing with this system at all, just click this button and work with Unity packages as you're probably expecting.
Otherwise, you can click "Add Selected Registries." This will kick off a somewhat complex process where:
The Firebase plugin adds a "Scoped Registry" to Unity (this is that code you see in the "After" pane). This tells Unity about Google's package repository.
The Plugin then looks for any package that is included in the registry and uninstalls it to avoid having it included twice.
The Plugin adds the package it uninstalled to your package manifest. This lets you maintain and update the Firebase plugin right in Unity with the "Package Manager" window:
There are plenty of reasons why you'd want to do this. First, the Firebase Unity SDK is HUGE on disk -- much larger than the SDK is even in your project. The reason is that it has redundant copies of every Firebase library for both legacy .NET3 projects and for modern .NET4 projects. Each unitypackage also has to include all of its dependencies -- that means that FirebaseCore is redundantly included in every unitypackage.
Second, what gets me the most, is that the Firebase plugin is too big to fit into a GitHub repo without Git LFS. This is because one or more of the libraries needed to support Linux is larger than a single source file can be. When you use the package manager, this stuff is kept out of your source repository (if you don't commit the Library/ directory, which you shouldn't) keeping your size in the cloud down and making this workaround unnecessary.
Third, as illustrated in the screenshot I included above, it's just easier to upgrade and downgrade the Firebase SDK as needed when you use the package manager. You no longer have to try to remember which Firebase libraries you've installed, you can see them in a neat list! You can also easily uninstall Firebase features that you don't need without worrying too much about large dependencies laying around (you still have to manually clean up some native plugins).
You can also perform all of this manually! Instead of downloading the Unity SDK, you can manually perform the steps as outlined here. Namely you can add:
"scopedRegistries": [
{
"name": "Game Package Registry by Google",
"url": "https://unityregistry-pa.googleapis.com",
"scopes": [
"com.google"
]
}
]
to the end of your Packages/manifest.json as indicated in that popup window. Then install and manage the Firebase plugin that way without worrying about migration at all.
EDIT:
I also should mention that if you do think that you're running into a bug, the system responsible for the dialog you're seeing is known as the "External Dependency Manager for Unity." You can file issues directly on its GitHub page.

Cannot find com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable class

My build.gradle is:
// for facebook account kit
compile 'com.facebook.android:account-kit-sdk:4.+'
// for google firebase database
compile 'com.google.firebase:firebase-database:9.6.0'
// for google firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:9.6.0'
After rebuild project,a error happens.
Error:(74, 27) error: Cannot access AbstractSafeParcelable
Cannot find
com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable class
==============================================
Resolution:
The reason is that after rebuilding the project, gradle download the latest version of "account-kit-sdk" to 4.25.0, the new version changes some about gms, so make some conflicts with firebase messaging,
So I downgrade the account-kit-sdk version, change import version from "account-kit-sdk:4.+" to "account-kit-sdk:4.24.0"
Then the issue has been resolved.
But I think it is not the best resolution about this problem.
Welcome friends add some new ways to resolve this issue.
Thanks.
Version 4.25.0 of com.facebook.android:account-kit-sdk has a dependency on com.google.android.gms:play-services-auth-api-phone:11.0.1 that is not present in version 4.24.0. com.google.android.gms:play-services-auth-api-phone adds many transitive dependencies on other com.google.android.gms modules, including base, basement, tasks, auth, and auth-base.
The Firebase libraries also have transitive dependencies on numerous com.google.android.gms modules. If the version numbers of all of the Firebase and Play Services modules in a build are not the same, problems such as this one occur.
A simple solution is to use version 11.0.1 of all Firebase and Play Services libraries you list in your gradle dependencies:
// for google firebase database
compile 'com.google.firebase:firebase-database:11.0.1'
// for google firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:11.0.1'
You should also specify a fixed version number for the Facebook library to make your build predictable and repeatable:
compile 'com.facebook.android:account-kit-sdk:4.25.0'
The risk of specifying the version as "4.+" is that when a new version is released that has transitive dependencies on a new version of the Play Services libraries, the new Facebook lib version will be automatically used and your build will break again.
To debug problems like this one, you can open the Gradle window in Android Studio and double-click on :app -> Tasks -> android -> androidDependencies to generate a dependency tree. The tree can then be examined to find version mismatches.

No Suggestion for <artifactId> on Spring MVC

First of all, I apologize for my english. When I try to create a .spring MVC project, I first created a maven project. Then, in pom.xml, nothing happens to my section. Below are the pom.xml and the project settings showing the mavel's fault.
SOLVED
Just update maven repository.Settings-> Build, Execution... -> Builds Tools -> Maven -> repositories.
You need to update/scan your repositories before you can use the auto-completion in the pom files.
Open Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Repositories, select the repository you want to update and hit the Update button.
(transferred comment to an answer to let others find it)

STS wizard for spring starter missing gradle option

Until very recently, the spring starter project wizard had a dropdown to select between maven & gradle. This is now missing and projects initialise with maven by default.
Can someone enlighten me as to why it's gone, and if there is any other automated way of initiating gradle based spring projects in STS/eclipse. It's not like I can't knock up my own gradle script, but I'm lazy like that.
Thanks
Can someone enlighten me as to why it's gone...
After some investigation I discovered that a recent change in the initializr app (http://start.spring.io) is responsible. The names for the import options in the webservice have been changed and they no longer match those used in the STS import wizard.
The import wizard ignores 'unknown' types (because it doesn't know how to import them). This causes the list of valid type options to become empty and so it is no longer shown by the STS wizard.
See https://github.com/spring-io/initializr/issues/42
I expect the problem to be fixed quickly (will update this answer when its fixed).
Update: The problematic changes to start.spring.io app have been reverted and the option should now work again in the STS wizard.
... and if there is any other automated way of initiating gradle based spring projects in STS/eclipse.
Yes, there is another thing you can use in the mean time. The "Import Getting Started Content" wizard. The short spring.io guides come in Maven and Gradle flavor. So importing one of those might be a good starting point.

Resources