AndroidManifest: resource integer/google_play_services_version not found - android

I have an android Studio (3.2.1) app, with base module and instantApp feature, Target API is 28. Since when I added Firebase, I started having this maniferst merge error in the title, which I solved adding:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
In the base app manifest, as mentioned in many answers on this topic.
App runs OK and firebase stuff works, but integration tests (and instant app) are broken with error:
resource integer/google_play_services_version (aka it.future.futureandroid.app:integer/google_play_services_version) not found.
Please notice that I added apply plugin: 'com.google.gms.google-services' in the base app gradle as well, while cloud messaging dependency is only specified inside feature module with:
implementation 'com.google.firebase:firebase-messaging:17.3.4'
while at project-level build.gradle i added:
classpath 'com.google.gms:google-services:4.2.0'
I already tried adding configurations.all as reported in similar questions with no luck. It seems that manifest merger, only with instantApp and integration tests, cannot resolve that integer/google_play_services_version

Related

Fabric crashlytics new implementation not working | fabric.properties

The implementation to put the apiSecret and apiKey in the fabric.properties file isn’t working anymore.
Fabric properties file: app/fabric.properties
apiSecret=xx68f6074dxxxxxc11dxxx97c172e8ebf0
apiKey=xxxe76c4xxxx97e8cxxxx0135e9d46f5a2xxx
Add to .gitignore (for open source projects)
Remove the entry at the AndroidManifest.xml:
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxx6c41xxx6ec601xxxd4xxxa2" />
Official documentation: https://docs.fabric.io/android/fabric/settings/working-in-teams.html#android-projects
Does anymore know what have changed or why this isn’t working anymore?
The issue appears to have been fixed (at least for me) with version 1.31.0 (July 24, 2019) of the Fabric Gradle plugin:
classpath 'io.fabric.tools:gradle:1.31.0'
Now when building an App Bundle the AndroidManifest.xml file includes the io.fabric.ApiKey meta-data element.
https://docs.fabric.io/android/changelog.html#july-24-2019

FirebaseApp is not initialized in this process - Additionally FirebaseApp.initializeApp() doesn't work. Dependency Problem?

I added the following line into the project gradle file:
classpath 'com.google.gms:google-services:4.0.0'
This into the module gradle file:
dependencies {
...
// GPS
implementation 'com.google.android.gms:play-services-location:16.0.0'
// FireBase
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-iid:17.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
}
apply plugin: 'com.google.gms.google-services'
And Added this into AndroidManifest.xml
<service
android:name=".pushclient.PushService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
I downloaded the google-services.json from FireBase Console and placed it at the correct position
But I get the following error when trying to use Firebase:
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process
When I initialize it manuall and try to get the ID, I get this error:
Caused by: java.lang.IllegalStateException: FirebaseInstanceId.getInstance() must not be null
I tried to set up a fresh new App and it works, but actually not with my project.
I think there is a dependency problem, but there is no error or hint.
I tried many different versions, none seems to work.
Do you have a solution for that?
The Problem was tools:node="replace" in an AndroidManifest.xml of a sub-module..
After I removed it and fixed the Manifest-Merger issues it worked fine!
Google should really give us a small hint that Firebase won't start if you use tools:node="replace" anywhere in your project.
If you are getting an error for initialising a firebase instance, you can use below method before you are trying to get the instance.
FirebaseApp.initializeApp(this);
Assuming you have added:-
google-services.json
done configuration in AndroidManifest.xml
You need to add google-services dependency in your project level gradle file.
buildscript {
repositories {---}
dependencies {
---
---
classpath 'com.google.gms:google-services:4.0.0'
}
}
You need to remove gcm dependency as well.
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
You must add configuration JSON to your app folder.
You can download this file on page with your project on firebase site.
Open Firibase Site -> Select you project -> Setting -> Select your app -> Clcik "google-services.json"

Uninstall track with AppsFlyer SDK error

I have integrated AppsFlyer SDK for analytics, it is tracking app installs but somehow when using uninstalls feature it crashes.
I have initialized SDK in MyApplication
AppsFlyerLib.getInstance().startTracking(this, Constants.APPS_FLYER_KEY);
I dont have GCM/FCM in my application so i have followed Android Uninstall Tracking
So i have written this code in my manifest
<service android:name="com.appsflyer.FirebaseInstanceIdListener">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
But it is not able to find FirebaseInstanceIdListener class
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.appsflyer.FirebaseInstanceIdListener"
Check the Android SDK installation steps. I followed this so I was not able to reproduce it.
So, I thought about possible cause, I tried to reproduce this error by simply not adding mavenCentral() in repositories object. And I faced the same error as you got.
Just to make sure if you have added below lines in your app.gradle before dependencies object:
repositories {
mavenCentral()
}
Adding to #Chintan-Soni's answer:
Our native Android SDK is distributed via MavenCentral repository, which replicates with the JCenter repository.
However, as we don't have control over this process, we instruct developers to add the MavenCentral repository to their project-level Gradle configuration file (build.gradle):
buildscript {
repositories {
mavenCentral()
}
}
And of course, Add the compile dependency with the latest version of the AppsFlyer SDK in the app-level build.gradle file:
dependencies {
compile 'com.appsflyer:af-android-sdk:4+#aar'
}
A local JAR file is another option to get the SDK.
You can find all the information required for integrating AppsFlyer SDK -
here.
Please submit any issues to support#appsflyer.com, so our support team could provide you with a quick and professional response.
When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , reproducing steps, logs, code snippets and any additional information that could help.

How to include Google Play Services to my project without help of any IDE?

I'm trying to determine correctness of the Google Play Services when my app starts. So I include
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
into my main activity file.
Then I've:
installed Play Services (and Google Repository as described here) via Android SDK Manager;
put compile 'com.google.android.gms:play-services:10.+' into my build.gradle
added
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
into AndroidManifest.xml
But when I'm trying to compile the project, I get this error:
Error: No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
I've found out that one way to solve it is to copy google-play-services_lib into my project folder and then add a link to it into project.properties file. But I have only /docs and /samples folders in sdk/extras/google/google_play_services. There is no such google-play-services_lib at all!
I don't use any IDE, my project is builded from CMake files, so any IDE plugins won't work for me...
How can I solve this?
Thank you!
Add the following in ur app gradle:
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
// ...
}
and the last line of app gradle as:
apply plugin: 'com.google.gms.google-services'
Also refer https://developers.google.com/android/guides/google-services-plugin, if necessary.

Crashlytics found an invalid API key - AndroidStudio build

I saw all other questions, but none of accepted answers is working for me.
By following integration steps found here https://dev.twitter.com/twitter-kit/android/integrate I have created crashlytics.properties file in module root. File is filled with apiKey and apiSecret values found in my newly created twitter application.
Error occurr on project build. I am using AndroidStudio 1.0
This is my error:
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: REAL_APIKEY_VALUE.
Check the Crashlytics plugin to make sure that the application has been added successfully!
Contact support#fabric.io for assistance.
You just forgot to add one line, in app-level gradle file.
apply plugin: 'com.google.gms.google-services'
this happens because when you are adding firebase:crashlytics, firebase document not have this line. so you need to add it manually. see this is firebase:crashlytics document photo.
This happened to me when I updated Android Studio from 3.2 to 3.3, to fix it I just updated the
classpath 'com.google.gms:google-services:4.1.0'
to
classpath 'com.google.gms:google-services:4.2.0'
And it worked again
Works fine added this on fabric.properties like this:
# Fabric properties file: app/fabric.properties
apiSecret=xx68f6074dxxxxxc11dxxx97c172e8ebf0
apiKey=xxxe76c4xxxx97e8cxxxx0135e9d46f5a2xxx
Add on .gitignore (for open source projects)
REMOVE entry on AndroidManifest.xml:
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxx6c41xxx6ec601xxxd4xxxa2" />
Oficial documentation: https://docs.fabric.io/android/fabric/settings/working-in-teams.html
I also experienced this issue and it took a while for me to realize I forgot adding the following line into the app/build.gradle:
apply plugin: 'com.google.gms.google-services'
After adding it, it started working like a charm even without <meta-data> in manifest and/or app/fabric.properties file.
Add the below line in app/build.gradle file
apply plugin: 'com.google.gms.google-services'
Clean The Project and Run.
after adding file fabric.properties, getting error as below.
Crashlytics found an invalid API key: null.
Check the Crashlytics plugin to make sure that the application has been
added successfully!
Contact support#fabric.io for assistance.
We need to register app and verify SHA-1 for same.
Add firebase: add google-services.json file from firebase console to your /app folder of your application.(follow steps given by Firebase Console-> Add Firebase to your Android app )
It's not giving error now
<meta-data android:name="com.crashlytics.ApiKey"
android:value="YOUR_API_KEY"/>
Add this one on Android manifest.xml
here you get the api key
https://www.fabric.io/kits/android/crashlytics/install
If someone is using crashlytics with Android dynamic features module, make sure your fabric and google-services plugins are applied only in your app module. In my case that was the problem.
Changing the below dependency at project build.gradle from :
classpath "com.google.gms:google-services:4.1.0"
to
classpath "com.google.gms:google-services:4.2.0"
has solved the problem for me.

Categories

Resources