Unable to instantiate service com.onesignal.HmsMessageServiceOneSignal:
Description: I faced issue of this on Huawei Y9 Prime 2019
Fatal Exception: java.lang.RuntimeException: Unable to instantiate service com.onesignal.HmsMessageServiceOneSignal: java.lang.ClassNotFoundException: Didn't find class "com.onesignal.HmsMessageServiceOneSignal" on path: DexPathList[[zip file "/data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/base.apk", zip file "/data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/split_config.arm64_v8a.apk", zip file "/data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/lib/arm64, /data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/base.apk!/lib/arm64-v8a, /data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/com.barfee.mart-EMNi6kGG2z0uhiQA_5K4Xw==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64]] at android.app.ActivityThread.handleCreateService(ActivityThread.java:4508) at android.app.ActivityThread.access$2600(ActivityThread.java:296) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2243) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:8178) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
(your description here)
Environment
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation fileTree(include: ['.jar'], dir: 'libs') implementation fileTree(dir: 'libs', include: ['.jar','.so']) implementation fileTree(dir: 'libs', include: ['.aar', '*.jar'], exclude: []) testImplementation 'junit:junit:4.12' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.android.gms:play-services-analytics:17.0.0' implementation 'com.google.android.gms:play-services-location:17.0.0' implementation 'com.google.android.gms:play-services-auth:17.0.0' implementation 'com.google.android.libraries.places:places:2.0.0' implementation 'com.google.android.gms:play-services-maps:17.0.0' implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.2'
implementation('com.onesignal:OneSignal:3.15.7') {
exclude group: "com.google.android.gms"
}
//facebook
implementation 'com.facebook.android:facebook-android-sdk:5.8.0'
implementation 'com.facebook.android:account-kit-sdk:5.4.0'
//Intercom
implementation 'io.intercom.android:intercom-sdk-base:5.5.1'
implementation 'io.intercom.android:intercom-sdk-fcm:5.5.1'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
//Aloglia
implementation 'com.algolia:algoliasearch-android:3.27.0'
implementation 'com.google.code.gson:gson:2.8.5'
//Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
//Lottie
implementation 'com.airbnb.android:lottie:2.5.0'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
// Recommended: Add the Google Analytics SDK.
implementation 'com.google.firebase:firebase-analytics:17.5.0'
// Add the Firebase Crashlytics NDK dependency.
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.2.1'
// Google Firebase
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-perf:19.0.0'
implementation 'com.google.firebase:firebase-config:19.0.2'
implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
// Add the In-App Messaging depencency:
implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.1'
//Material dots
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.1'
//Facebook shimmer effect
implementation 'com.facebook.shimmer:shimmer:0.3.0'
implementation 'androidx.emoji:emoji-appcompat:1.0.0'
// required for all Android apps
implementation 'io.branch.sdk.android:library:5.0.7'
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
implementation 'com.github.douglasjunior:android-simple-tooltip:0.2.3'
implementation 'com.github.vihtarb:tooltip:1.0.0-alpha05-SNAPSHOT'
implementation 'com.hbb20:ccp:2.3.6'
implementation 'com.github.cdflynn:checkview:v1.1'
implementation('com.alimuzaffar.lib:pinentryedittext:1.3.10') {
// Exclude is only needed if you already have
// any of the following as a dependency in your project.
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v13'
}
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
implementation "com.google.android.gms:play-services-auth:16.0.1"
implementation 'com.github.babar-razzaq123:tpg_sdk:2.6'
implementation 'com.github.splatte:ViewPagerIndicator:3.0.0'
implementation 'com.jsibbold:zoomage:1.3.0'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.github.MikeOrtiz:TouchImageView:2.3.3'
implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
implementation 'commons-codec:commons-codec:1.9'
implementation 'com.clevertap.android:clevertap-android-sdk:4.0.0'
implementation 'com.android.installreferrer:installreferrer:2.1'
implementation 'com.github.bumptech.glide:glide:4.9.0'//MANDATORY for App Inbox
implementation 'com.google.firebase:firebase-messaging-directboot:20.2.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.github.checkout:frames-android:2.2.0'
implementation 'org.jsoup:jsoup:1.11.1'
implementation files('libs\\YouTubeAndroidPlayerApi.jar')
Steps to Reproduce Issue:
- (your steps here)
Anything else:
(crash stacktraces, as well as any other information here)
@kaleemsabir Are you using proguard or any other tools to minify or obfuscate your code?
- If so could you share your full config file for this so we an attempt to reproduce the issue?
- If you disable it do you still see this issue?
This could be causing the class not to be found.
@kaleemsabir Are you using proguard or any other tools to minify or obfuscate your code?
- If so could you share your full config file for this so we an attempt to reproduce the issue?
- If you disable it do you still see this issue?
This could be causing the class not to be found. thanks for reply
uildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' } } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10' } } apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories { maven { url 'https://maven.google.com' } maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
apply plugin: 'com.android.application' apply plugin: 'com.google.firebase.firebase-perf' apply plugin: 'com.google.firebase.crashlytics'
android { signingConfigs {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
bundle {
language {
enableSplit = false
}
}
compileSdkVersion 29
buildToolsVersion '28.0.3'
dataBinding {
enabled = true
}
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 200
versionName "6.0.2"
multiDexEnabled true
resConfigs "en", "US", "ur"
}
buildTypes {
debug {
// Disable fabric build ID generation for debug builds
firebaseCrashlytics {
// If you don't need crash reporting for your debug build,
// you can speed up your build by disabling mapping file uploading.
mappingFileUploadEnabled false
}
ext.enableCrashlytics = false
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String',"GMPKEY",google_maps_key
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String',"GMPKEY",google_maps_key
}
}
flavorDimensions 'tiers'
productFlavors {
staging {
signingConfig signingConfigs.release
}
dev {
signingConfig signingConfigs.release
}
probe {
signingConfig signingConfigs.release
}
prod {
signingConfig signingConfigs.release
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories { maven { url "https://jitpack.io" } mavenCentral() jcenter() }
Fatal Exception: java.lang.RuntimeException Unable to instantiate service com.onesignal.HmsMessageServiceOneSignal: java.lang.ClassNotFoundException: Didn't find class "com.onesignal.HmsMessageServiceOneSignal" on path: DexPathList[[zip file "/data/app/com.smartsco.recaru-J1nEFZZm0VlePHn7aJlLhg==/base.apk"],nativeLibraryDirectories=[/data/app/com.smartsco.recaru-J1nEFZZm0VlePHn7aJlLhg==/lib/arm64, /data/app/com.smartsco.recaru-J1nEFZZm0VlePHn7aJlLhg==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]
Brand:HUAWEI Model:LIO-AL00 Orientation: Portrait RAM free: 5.95 GB Disk free: 43.2 GB
Operating System Version:10 Orientation: Portrait Rooted:No
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.8' implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@kaleemsabir Were you able to resolve this issue?
Closing due to inactivity. Feel free to reopen if this is still a problem!