I'm having issues including Google services in my project.
The errors
Following these instructions, and also referring to the docs to set it up, I encounter a problem with the apply plugins property:
For reasons unbeknownst to me, it's not fetching correctly (something about the version being wrong) even though that property is auto-filled when you click on 'Add FCM to your app' (in purple). And as you can see, it doesn't have any version numbers in the URL.
I also encounter a problem with the implementation 'com.google.firebase:firebase-messaging:17.1.0' property.
I'll add in my manifest and gradle files for reference:
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.nationscompanies.uordermobile">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:fullBackupContent="#xml/backup_descriptor">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyAndroidFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyAndroidFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nationscompanies.uordermobile"
minSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.google.android.gms:play-services-gcm:15.0.1'
api 'com.google.firebase:firebase-core:16.0.1'
api 'com.google.firebase:firebase-messaging:17.1.0'
}
apply plugin: 'com.google.gms.google-services' // this is the line that gets autofilled when you click on the 'Add FCM to your app' button from Firebase manager
Full error message
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.1.
And then a giant list of errors:
Change this:
classpath 'com.google.gms:google-services:3.1.1'
into this:
classpath 'com.google.gms:google-services:4.0.2'
to prevent from getting the version conflict error.
Check here for more info:
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Beginning with version 15 of all Play services and Firebase libraries, each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time.
In order to support this change in versioning, the Play services Gradle plugin has been updated to 3.0.0(which is the first version).
Related
I'm trying to use MoPub using AdMob mediation. I've followed all instructions at https://developers.google.com/admob/android/mediation/mopub.
Currently I use facebook, applovin, inmobi through admob mediation and all of them work well. I integrated MoPub several times but it always says manifest not found. The problem is in step 3 https://developers.google.com/admob/android/mediation/mopub#step_3_import_the_mopub_sdk_and_adapter.
Note: I'm using androidX.
when testing I see this. I used admob mediation test suite and found like this.
Here is my app-level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion '30.0.1'
defaultConfig {
applicationId 'com.theaccidentalmedico.sociology'
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'MissingTranslation'
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
jcenter()
maven {
url "https://s3.amazonaws.com/moat-sdk-builds"}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
implementation 'com.google.ads.mediation:facebook:5.9.0.0'
implementation 'com.google.ads.mediation:mopub:5.13.1.0'
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation 'com.google.ads.mediation:applovin:9.13.0.0'
implementation 'com.google.android.ads:mediation-test-suite:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.13'
}
Here is my project level build.gradle.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm using AndroidX. Here is my gradle.properties file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
In admob implementation guide no instruction is given to edit androidmanifest.xml file. Here's my androidmanifest.xml file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.theaccidentalmedico.sociology">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:networkSecurityConfig="#xml/network_security_config"
android:icon="#mipmap/ic_launcher_foreground"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppThemeDefault"
tools:targetApi="n">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8803330956819211~8267554096"/>
<activity
android:name="com.theaccidentalmedico.sociology.MainTabActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:windowSoftInputMode="adjustPan|adjustResize"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theaccidentalmedico.sociology.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize" />
<activity
android:name="com.theaccidentalmedico.sociology.MeaningActivity"
android:label="#string/title_meaning_activity" />
<activity android:name="com.theaccidentalmedico.sociology.FavoriteActivity" />
<activity android:name="com.theaccidentalmedico.sociology.SettingActivity" />
<activity android:name="com.theaccidentalmedico.sociology.HistoryActivity"/>
</application>
</manifest>
SOLVED
This problem with Mopub was because of mediation test suite 1.3.0.
Solution:
Go to you app-level build.gradle and change mediation test suite version to 1.4.0.
That solves the problem.
https://groups.google.com/g/google-admob-ads-sdk/c/NGMX-2P-sAM/m/v32f4uEhAAAJ
Add to AndroidManifest.xml
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.RewardedMraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.privacy.ConsentDialogActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm trying to implement my first sceneform application.
I'm following the following tutorials:
My references:
https://www.youtube.com/playlist?list=PLsOU6EOcj51cEDYpCLK_bzo4qtjOwDWfW
https://developers.google.com/ar/develop/java/quickstart
I'm using the following configurations:
mac os High Sierra - Version 10.13.6 (17G7024)
Android Studio - 3.1.3
My app's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myfirstapp.example.com.helloar"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Provides ArFragment, and other UX resources.
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.11.0'
implementation 'com.google.ar:core:1.11.0'
// Alternatively, use ArSceneView without the UX dependency.
implementation 'com.google.ar.sceneform:core:1.11.0'
}
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
My project's gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.ar.sceneform:plugin:1.11.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myfirstapp.example.com.helloar">
<uses-permission android:name="android.permission.CAMERA" />
<!-- "AR Required" apps must declare minSdkVersion ≥ 24 -->
<uses-sdk android:minSdkVersion="24" />
<!-- Indicates that the app requires ARCore ("AR Required"). Ensures the app is
visible only in the Google Play Store on devices that support ARCore.
-->
<uses-feature android:name="android.hardware.camera.ar" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.ar.core" android:value="required" />
</application>
</manifest>
When I right clicked on .obj file and clicked on import sceneform asset. It's throwing the adding the following to my app's gradle file
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
Error Given:
Unable to find method 'com.android.build.gradle.api.ApplicationVariant.getMergeResourcesProvider()Lorg/gradle/api/tasks/TaskProvider;'.
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Kindly help with the fix.
I've upgraded my android studio to 3.4.2 and it's working now.
I finally start to experiment with Firebase Cloud Messaging Service in Android Studio. I try this tutorial and I have exactly the same classes like in this tutorial:
enter link description here
My first Question is, why did the "Android Monitor" in Android Studio, show me the device token only one time? Everytime I start a new Project in Firebase and connect it with my AppProjekt and run it, the Token just showed me the first time when I run the project without troubles. If I run it again, I don't see anything of this Token, nothing!
Second Question is, why I don't get the Push Notification from Firebase?
Here is my Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.felixkoepping.pushtest2">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
Here is the gradle File in app Section:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
multiDexEnabled true
applicationId "com.example.felixkoepping.pushtest2"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-messaging:9.2.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Here is the gradle File of the project Section:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The only "red Message" in Android Monitor is:
E/FA: Failed to send event to AppMeasurementService:
android.os.DeadObjectException:
com.google.android.gms.measurement.internal.zzm$zza$zza.zza(Unknown Source)
If I send a notification from the Console in Firebase to exactly this Device with the Token, nothing will be shown in my Emulator...
I hope some of you guys can help me with this Problem. I tried so much, but nothing works...
Thanks Guys :-)
thanks for writing in. I'll be helping today to get your problem resolved.
The notification sent from the console will show up only when the app is closed or in it's background state.
To make the app show notifications in the foreground state, refer to this link Firebase notifications in the foreground
If you're still unaware of what happens, ping me through the comment facility, thanks!
I am completely new to Android Studio so it may sound a silly thing to an experienced person.
I am getting an error in Android Studio which states:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value
value=(25.3.1) from [com.android.support:design:25.3.1]
AndroidManifest.xml:27:9-31
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1]
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at
AndroidManifest.xml:25:5-27:34 to override.
I have Googled this and tried looking into it to solve it on my own, however, similar issues that I have found aren't quite the same errors.
I'm not experienced enough to understand and generate a fix for it although I understand some of it.
It may be the case that I need to provide more information for this so please let me know if so.
EDIT:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.g732d.appname"
>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".HomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Patients" />
<activity android:name=".NewPatient" />
<activity android:name=".StartActivity"></activity>
</application>
</manifest>
build.gradle (Project: appname):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module: App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.g732d.appname"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
}
SECOND EDIT:
Following the answer by Arefeh and the comment by Kunal, I changed the version mismatch by replacing compile 'com.android.support:design:25.3.1' with compile 'com.android.support:design:26.0.0-beta2'.
For this to work, I had to add maven { url "https://maven.google.com" } in the build.gradle (Project: appname) file within allprojects{} (have updated above to illustrate this).
Now I keep getting a render error which says failed to instantiate one or more classes. The classes are different for each activity depending on what I've used in the activity e.g.
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView
...
...
I guess the problem is for difference between versions of support libraries. Change your version of design library to 26 or higher.
compile 'com.android.support:design:26.+'
What seems to have worked in this instance, is going to File > Project Structure then in app > Properties where it says Compile Sdk Version and Build Tools Version, I changed them to API 25: Android 7.1.1 (Nougat) and 25.0.3 respectively. After which I synced the project and gradle and then rebuilt.
I then repeated the process and changed back again to API 26: Android 8.0 (O) and 26.0.0. So far it is working again although I will update if this changes.
I am trying to use Firebase crash reporting and notifications on an Android Project I inherited from my predecessor in my place of work.
For some unknown reason Firebase or OneSignal has refused to work on the project,it doesn't matter whether the app is in background or not. I implemented Firebase using the Android Studio Assistant.
However if I create fresh projects and implement Firebase or OneSignal it works glitchlessly.
Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.myfirm.appname"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:customtabs:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.onesignal:OneSignal:3.4.3'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myfirm.appname">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="#drawable/notification_icon"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:node="replace">
<service
android:name=".services.TokenService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data android:name="onesignal_app_id" android:value="#string/onesignal_app_id" tools:replace="android:value"/>
<meta-data android:name="onesignal_google_project_number" android:value="#string/onesignal_google_project_number" tools:replace="android:value"/>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_appid" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fbXXXXXXXXXXXX" />
</intent-filter>
</activity>
// More Activities
</application>
</manifest>
MyApplication
#Override
public void onCreate() {
super.onCreate();
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.NONE);
FirebaseApp.initializeApp(this);
// Removed some code
OneSignal.startInit(this)
.setNotificationReceivedHandler(new OneSignalMessageReceiver())
.init();
}
A few things to note:
The app is always in background (I launched it and pressed the home button) when I send the notifications.
On the dashboards (both Firebase and OneSignal), the message says it's been successfully sent.
I'm getting the device token on Firebase and I uses it to send notifications. Sometimes it says notification has been sent and at other times it says token not registered.
The reason why it appears I'm using both Firebase and OneSignal is because I tried Firebase first, it didn't work. Then I used OneSignal hoping hat it would Work but it didn't. So if any one works, I remove the other.
The google-services.json exists in ProjectName > app and yes, the package name correspond with that in manifest.
The crash reports are not showing on Firebase dashboard even when the app has crashed severally.