android Kochava SDK integration crashes the app with google sdk - android

I just integrated Kochava SDK to my app recently. While I installing or running apk first time its crashed, but its working fine while running second time! However I also checked by generating signed(released) apk and then installing manually on device then its continuously crashing!
Here is my Project gradle file:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
maven {url "http://kochava.bintray.com/maven"}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jcenter.bintray.com" }
jcenter()
google()
maven {
url 'https://maven.google.com/'
}
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
maven { url "https://jitpack.io" }
maven {url "http://kochava.bintray.com/maven"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And Module gradle file is:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
dataBinding {
enabled = true
}
defaultConfig {
applicationId "xyz.xyz.myapplication"
minSdkVersion 19
targetSdkVersion 28
versionCode 31
versionName "4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
ignoreAssetsPattern "!*ffprobe"
ignoreAssetsPattern "!*ffmpeg"
ignoreAssetsPattern "!arm"
ignoreAssetsPattern "!x86"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
android.buildTypes.each { type ->
type.buildConfigField 'String', 'Base_URL', WEBServiceBaseURL
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Android necessary...
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//Support libs...
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'commons-io:commons-io:2.6'
//Facebook ads
implementation 'com.google.ads.mediation:facebook:5.6.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.6.0'
implementation 'com.facebook.android:facebook-android-sdk:4.41.0'
//Firebase
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-ads:18.3.0'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.android.play:core:1.6.4'
//FFMPEG
implementation 'com.writingminds:FFmpegAndroid:0.3.2'
//Image crop
implementation 'com.naver.android.helloyako:imagecropview:1.2.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
//Exo Player
implementation 'com.google.android.exoplayer:exoplayer:2.10.5'
//Progress bar
implementation 'com.dinuscxj:circleprogressbar:1.3.0'
//Range seekbar
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
//Glide...
implementation 'com.github.bumptech.glide:glide:4.9.0'
//GPUImage...
implementation 'jp.co.cyberagent.android:gpuimage:2.0.3'
//Fetch a downloader library...
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4"
implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.4"
//Downloader for Android 19...
implementation 'com.mindorks.android:prdownloader:0.6.0'
//Lottie...
implementation 'com.airbnb.android:lottie:3.2.0'
//Volley for Anfroid 4!
implementation 'com.android.volley:volley:1.1.1'
//Introduction for any screen...
implementation 'com.github.paolorotolo:appintro:4.0.0'
//ViewPagerEffects...
implementation 'com.eftimoff:android-viewpager-transformers:1.0.1#aar'
//Kochava...
implementation 'com.kochava.base:tracker:3.6.3'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'com.android.installreferrer:installreferrer:1.1'
//AVLoader...
implementation 'com.wang.avi:library:2.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':jiaozivideoplayer')
}
apply plugin: 'com.google.gms.google-services'
I also implemented Application class as per suggestion and rule:
public class MyApplication extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics())
.debuggable(true)
.build();
Fabric.with(fabric);
AudienceNetworkAds.initialize(this);
AudienceNetworkAds.isInAdsProcess(this);
MobileAds.initialize(this, getString(R.string.app_id));
if (Build.VERSION.SDK_INT < 21) {
PRDownloaderConfig config = PRDownloaderConfig.newBuilder()
.setReadTimeout(30_000)
.setConnectTimeout(30_000)
.build();
PRDownloader.initialize(getApplicationContext(), config);
}
Tracker.configure(new Tracker.Configuration(getApplicationContext())
.setAppGuid("koboo-8bod4gz3")
.setLogLevel(Tracker.LOG_LEVEL_INFO)
);
}
}
Above code is OK for Kochava integration. But another thing is that, here I also need all those google and firebase sdk! So, may be its problem is in between google sdk and Kochava sdk! But I need can't remove google sdk or crashlytics and also I need to integrate Kochava for tracking my application in Ad campaign in "Tik Tok" as per its suggestion!
Well if I don't initialize Tracker.configure(....); in application class then app run fine and not crashing but then Kochava not working!
So, after initialize Tracker.configure(...); Kochava sdk it will be generate error:
2019-12-03 15:33:14.254 E/AndroidRuntime: FATAL EXCEPTION: main
Process: xyz.xyz.myapplication, PID: 6113
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/aidl/BaseStub;
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:133)
at com.kochava.base.c$a.run(Unknown Source:15)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.aidl.BaseStub" on path: DexPathList[[zip file "/data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/base.apk"],nativeLibraryDirectories=[/data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/lib/x86, /data/app/videostatusmaker.videostatus.boo-Ptd9gTEkM8rXlvGCnCByPg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:133) 
at com.kochava.base.c$a.run(Unknown Source:15) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
May be there is some problem in Kochava library or something I missing in integration?! Please tell me what is the problem? Or it is not suitable with google sdk?
Here is the link for Android Kochava SDK integration.

Well if you have more than one module in your app then put all Kochava dependencies in all of those module :
implementation 'com.kochava.base:tracker:3.6.3'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'com.android.installreferrer:installreferrer:1.0'
These all must be in all module level gradle files. This is not mentioned is in documentation but you can try it. Because I tried your code in my application and I also have Google ads and other Google's libraries and also have three modules in my app. But added these libraries in all modules than its work perfectly!
I don't know if you have more than one module in your app but if there is than this will helpful.

EDIT
It has been fixed by google, on the same version...
It should work now, if it's still crashing it's probably linked to the previous version being cached, the following should fix it:
implementation('com.android.installreferrer:installreferrer:1.1') { changing .= true}
More information here: https://github.com/adjust/android_sdk/issues/402
Try with com.android.installreferrer:installreferrer:1.0 instead of 1.1
Looks like IGetInstallReferrerService expects com.google.android.aidl.BaseStub in the 1.1 implementation, which does not come with installreferrer

mVck is correct and as far as we can tell, it's likely on Google's end and looks to be specific to version 1.1 of their library. This is our theory because it appears others on SO are experiencing similar issues with other vendor SDKs.
We've reached out to our Google reps to confirm, but in the meantime, please
stay on version 1.0 of Google's library as indicated above. Once we receive confirmation we'll be sure and update our support documentation. Thanks!

I just ran into the same thing and what fixed it for me was to delete the install referrer dependency from my gradle cache and then re-sync with gradle. I think it was something to do with the cached aar. It's bizarre though because it was fine earlier this week and the aar didn't change as far as I'm aware. Regardless, deleting it and re-syncing did the trick for me.

I was having trouble downgrading to 1.0 after attempting to fix this issue with the 1.1.1 fix. In my case the installreferrer was adding the permission READ_PHONE_STATE to my application. Gradle was attempting to resolve 1.1 even after I backed down the version to 1.0 in my app.gradle.
In order to fix this I now force installreferrer to use version 1.0.
dependencies {
configurations.all {
resolutionStrategy.force 'com.android.installreferrer:installreferrer:1.0'
}
implementation 'com.android.installreferrer:installreferrer:1.0'
}

Related

Room kapt error when upgrading kotlin or gradle

I have been having for a long time this problem: I cannot upgraded the gradle version and kotlin gradle plugin in my app in Android Studio, the only solution that I can think of is to start a project from scratch and move one by one every class.
My app uses Room and therefore kapt as annotation process. With this version of kotlin and gradle everything works perfectly:
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50'
my app gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
//Kapt is the annotation processor of kotlin, all the generated code Ex. #Room depends of it
apply plugin: 'kotlin-kapt'
kapt {
generateStubs = true
correctErrorTypes = true
mapDiagnosticLocations = true
javacOptions {
// Increase the max count of errors from annotation processors.
// Default is 100.
option("-Xmaxerrs", 700)
}
}
android {
signingConfigs {
Default {
...
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.android.expenses"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.Default
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
sourceSets {
// Adds exported schema location as test app assets.
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
buildTypes {
debug {
....
}
release {
....
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
//To avoid duplicate class clash
exclude group: 'com.google.guava', module: 'listenablefuture'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
//Para parcelize y autobinding in kotlin
androidExtensions {
experimental = true
}
kotlinOptions {
jvmTarget = '1.8'
}
//De databinding, y kotlinx
/*dataBinding {
enabled = true
}*/
//Substitule to 3 line above with this
android.buildFeatures.dataBinding true
}
dependencies {
//version definition
def room_version = "2.2.5"
implementation fileTree(include: ['*.jar'], dir: 'libs')
//androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
//})
testImplementation 'junit:junit:4.12'
// Required for instrumented tests
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
//Architecture
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'joda-time:joda-time:2.7'
implementation 'org.joda:joda-money:0.10.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.neovisionaries:nv-i18n:1.15'
implementation 'de.hdodenhof:circleimageview:2.2.0'
//ColorPicker
implementation 'com.jaredrummler:colorpicker:1.1.0'
//Image Cropper
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
// Google Sheet API y Google Drive
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'pub.devrel:easypermissions:3.0.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
// Google Sheet API
implementation('com.google.apis:google-api-services-sheets:v4-rev504-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
// Google Drive Rest
implementation('com.google.apis:google-api-services-drive:v3-rev102-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
//Google Drive Android
implementation "com.google.android.gms:play-services-drive:$rootProject.playServices_version"
//Google Maps
implementation "com.google.android.gms:play-services-location:$rootProject.playServices_version"
implementation 'com.google.android.gms:play-services-maps:16.1.0'
//Google Maps Utils
implementation 'com.google.maps.android:android-maps-utils:0.5'
//Google Places
implementation "com.google.android.gms:play-services-places:$rootProject.playServices_version"
//MultiViewAdapter para mejores recyclerviews
implementation 'com.github.devahamed:multi-view-adapter:1.2.6'
implementation 'com.github.devahamed:multi-view-adapter-databinding:1.2.6'
//CardView
implementation 'androidx.cardview:cardview:1.0.0'
//PagerSlidingTabStrip
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
//Room
implementation "androidx.room:room-runtime:$room_version"
//annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - Kotlin Extensions and Coroutines support for Room
//implementation "androidx.room:room-ktx:$room_version"
// Test helpers
androidTestImplementation "androidx.room:room-testing:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// Lifecycle components
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.3.1'
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.1'
//Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
// RxJava support for Room
implementation 'androidx.room:room-rxjava2:2.0.0'
//Android Palette API
implementation 'androidx.palette:palette:1.0.0'
//Welcome Activity
implementation 'com.github.AppIntro:AppIntro:6.1.0'
//Charts
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
//TableView
implementation 'com.evrencoskun.library:tableview:0.8.8'
//Anko Commons Library for easier development
implementation "org.jetbrains.anko:anko-commons:$anko_version"
//Search Dialog
implementation 'com.github.mirrajabi:search-dialog:1.2.4'
//FAB Button Speed Dial
implementation 'com.leinardi.android:speed-dial:3.2.0'
//WorkManager
implementation('androidx.work:work-runtime-ktx:2.0.1') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
//PagingList
implementation 'androidx.paging:paging-runtime:2.1.0'
//Calendar
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'
//Image Compressing
implementation 'id.zelory:compressor:3.0.1'
//New Places: Old one is deprecated
implementation 'com.google.android.libraries.places:places:2.4.0'
// Koin for Android
implementation 'org.koin:koin-android:2.0.0-rc-2'
implementation 'org.koin:koin-android-viewmodel:2.0.0-rc-2'
// KTX
implementation 'androidx.core:core-ktx:1.3.2'
// Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
// Moshi
implementation 'com.squareup.moshi:moshi:1.8.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.8.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1'
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//SQLCipher
implementation "net.zetetic:android-database-sqlcipher:4.4.0#aar"
....
}
repositories {
mavenCentral()
}
// For Firebase
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
I tried to update to the current newest version of each, although this problem exists in not so new versions
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
In order to make this change I did the following:
Update Java jdk to 11
Replace kotlin-android-extensions with 'kotlin-parcelize' and viewBinding = true
Remove androidExtensions: experimental=true
Replace the parcelize import with kotlinx.parcelize.Parcelize
Even all this, I still have this error
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
There are messages below app:kaptDebugKotlin but they are warnings of multiple constructors of non #Entity classes which shouldn't provoke the crash
This is really frustrating cause I don't know what else to do or how to get more information (I also did a run with --info and I only get the same output from kapt)
Thank you in advance for your time and help
UPDATE
Here is my top gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//ext.kotlin_version = '1.4.10'
//Working version
ext.kotlin_version = '1.3.50'
//Latest version
//ext.kotlin_version = '1.5.20'
//ext.kotlin_version = '1.3.41'
repositories {
mavenCentral()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
//jcenter()
}
dependencies {
// working version, if change modify distributionUrl in gradle-wrapper.properties
classpath 'com.android.tools.build:gradle:4.0.2'
// to upgrade
//classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
//De MaterialChipsInput y Search Dialog
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext{
archLifecycleVersion = '1.1.1'
anko_version='0.10.5'
support_version = '28.0.0'
playServices_version = '16.0.0'
}
Quick update, when I try to upgrade only the room version to 2.3.0 the error occurs:
[kapt] An exception occurred: java.lang.NoSuchMethodError: kotlin.jvm.internal.FunctionReferenceImpl.<init>(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
at androidx.room.log.RLog$CollectingMessager$writeTo$printMessage$1.<init>(RLog.kt)
at androidx.room.log.RLog$CollectingMessager.writeTo(RLog.kt:92)
at androidx.room.solver.TypeAdapterStore.findRowAdapter(TypeAdapterStore.kt:520)
at androidx.room.solver.TypeAdapterStore.findQueryResultAdapter(TypeAdapterStore.kt:459)
at androidx.room.solver.binderprovider.InstantQueryResultBinderProvider.provide(InstantQueryResultBinderProvider.kt:29)
at androidx.room.solver.TypeAdapterStore.findQueryResultBinder(TypeAdapterStore.kt:391)
at androidx.room.processor.DefaultMethodProcessorDelegate.findResultBinder(MethodProcessorDelegate.kt:140)
at androidx.room.processor.InternalQueryProcessor.getQueryMethod(QueryMethodProcessor.kt:204)
at androidx.room.processor.InternalQueryProcessor.processQuery(QueryMethodProcessor.kt:135)
at androidx.room.processor.QueryMethodProcessor$process$1.invoke(QueryMethodProcessor.kt:67)
at androidx.room.processor.QueryMethodProcessor$process$1.invoke(QueryMethodProcessor.kt:37)
at androidx.room.processor.Context.collectLogs(Context.kt:133)
at androidx.room.processor.QueryMethodProcessor.process(QueryMethodProcessor.kt:61)
at androidx.room.processor.DaoProcessor.process(DaoProcessor.kt:99)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:100)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:51)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:47)
at androidx.room.compiler.processing.JavacProcessingStepDelegate.process(XProcessingStep.kt:111)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:79)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:35)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:230)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:188)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1558)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Any idea why and is it related?
SOLUTION:
In case anyone is searching for something similar, I finally redid the project and the problem was related with moshi kapt. I update the library to 1.12.0 and everything works
In my case, I have faced the same issue while I have upgraded "kotlin-gradle-plugin: from 1.5.31 to 1.6.10".
I have solved this issue by Upgrading Gradle Version to the latest version by following official docs.
In android studio got to File>Project Structure>Project>Gradle Version here select the latest version of Gradel.
I think, This happens when we update "kotlin-gradle-plugin" and the other dependencies are not the latest version.
Also, Check your JDK version you can follow official docs.
Upgrade room to 2.4.0-beta02 will fix your problem. Because it fix mine.
We've added a new TypeConverter analyzer that takes nullability information in types into account. As this information is only available in KSP, it is turned on by default only in KSP. If it causes any issues, you can turn it off by passing room.useNullAwareTypeAnalysis=false to the annotation processor. If that happens, please a file bug as this flag will be removed in the future. With this new TypeConverter analyzer, it is suggested to only provide non-null receiving TypeConverters as the new analyzer has the ability to wrap them with a null check. Note that this has no impact for users using KAPT or Java as the annotation processors (unlike KSP), don't have nullability information in types. (Ia88f9, b/193437407)
https://developer.android.com/jetpack/androidx/releases/room#2.4.0-beta02
In your dependencies below the //Room comment add the following :
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
and make sure you are using latest room_version = [2.3.0]

Failed to resolve variable '${animal.sniffer.version}' when migrate to AndroidX

I'm using Android Studio 3.2 Beta5 to migrate my project to AndroidX. When I rebuild my app I got these errors:
ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'
ERROR: [TAG] Failed to resolve variable '${junit.version}'
Full clean & rebuild did not work! Anyone know how to fix this?
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta05'
classpath 'com.google.gms:google-services:4.0.1'
classpath "io.realm:realm-gradle-plugin:5.3.1"
classpath 'io.fabric.tools:gradle:1.25.4'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.iceteaviet.fastfoodfinder"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0-rc01'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'io.realm:realm-android-library:5.3.1'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.0.2'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.google.firebase:firebase-perf:16.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}
apply plugin: 'com.google.gms.google-services'
I fix this with two steps
1) File -> Invalidate Caches / restart...
2) Build -> Clean project
I got the same error after updating my build.gradle file with AndroidX Test dependencies. Turns out I forgot to remove the old junit dependency. So for me, the fix was simply to remove the following dependency:
dependencies {
...
testImplementation 'junit:junit:4.12'
}
Adding Java 8 support to build.gradle file fixed issue for me
android {
...
//Add the following configuration in order to target Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
It seems to be Glide the problem.
I had the same error and I just updated the Glide's dependencies to 4.8 and there is no build errors.
Kotlin :
// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
Java :
// Glide
def glide_version = "4.8.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
Be sure to have enabled in your gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
Source : https://github.com/bumptech/glide/issues/3124
Hope this will help you!
Fixed it by going to the main directory and typing flutter clean
Removing the testInstrumentationRunner worked for me:
defaultConfig {
...
...
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
If you're using Kotlin, the issue will popup if don't use the kapt version for any annotation processor you use in the project.
As #Vince mentioned the case with Glide, this could happen with Dagger2, Butterknife, etc.
If you're using both Java and Kotlin you'll need to keep both dependencies, as follows (were $glideVersion is a predefined version of Glide):
implementation "com.github.bumptech.glide:glide:$glideVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
If you're on a Kotlin only project, the kapt dependency should work alone.
EDIT
Another thing you should have in mind is if you're already using Androidx. Androidx is a great refactor but when migrating it can cause some of your dependencies to collapse. Mainstream libraries are already updated to Androidx, however, some of them are not and even won't.
If the issue doesn't go away with my provided solution above this edit, you can take a look at your dependencies and make sure they use Androidx as well.
EDIT 2
As #Ted mentioned, I researched back and he's right kapt does handle java files as well. kapt alone will do the trick, no need to keep both kapt and annotationProcessor dependencies.
Try removing this line:
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
from the buildscript / repositories section of your build.gradle file.
When I added that line, I got the error you described. When I removed it, no longer. That line should only be in the allprojects / repositories section.
Try set android.enableJetifier=false in gradle.properties. Then Invalidate Caches / Restart ... in Android Studio
The fix is in 4.2.0, use the higher version of google gms jar.
Try changing:
classpath 'com.google.gms:google-services:4.0.1'
by this version:
classpath 'com.google.gms:google-services:4.2.0'
Hope this works...
If you are using dagger or butterknife, please make sure to update it to the latest version. Or, if you have another injection library used in your project, you can try to check it if it support androidx or no.
I've found same error, the problem is on my dagger and butterknife. Have fixed it by updating it to newest version.
Android version: 4.10.2
I solved this issue with three simple steps:
First i added below this in pubspec.yml:
(with two spaces of identation)
module:
androidX: true
Adding this two lines below in gradle.properties, i have this in android/gradle.properties, in the project folder.
android.useAndroidX=true
android.enableJetifier=true
And after this i wrote with the terminal:
flutter clean
Maybe you will have to stop the device and run again.
I fixed this by updating the firebase dependencies to the latest.
I faced this error after adding butterknife to my project.
In order to resolve this error you should use Java8.
I would recommend this answer.
How I resolved it:
1.add following code in build.gradle (module: app)
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
clean prject and run.
I fixed it by refreshing the cahche (Instead of invalidating it - which also clears the local history):
in gradle.properties file, comment the line org.gradle.caching=true.
Clean, Rebuild.
in gradle.properties file, un-comment the line
org.gradle.caching=true.
Clean, Rebuild.
Thats it!
Go to file and click on Invalidate caches and restart.
After it restarts then you increase the minimum SDK version in your app's build.gradle file.

App crashes on first install through Play Store [duplicate]

since I've updated to Android Studio 3.1, my project is not running anymore. I have searched for a solution all over the internet with no positive results.
Here's the error I get in the Logcat:
--------- beginning of crash
04-13 13:33:55.466 12720-12720/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: woopy.domain.com.woopy, PID: 12720
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/base.apk"],nativeLibraryDirectories=[/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
at android.app.ActivityThread.-wrap1(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
04-13 13:33:55.567 12720-12727/? I/zygote: Debugger is no longer active
Here's my build.gradle (Module:app) file:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "woopy.domain.com.woopy"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
aaptOptions {
cruncherEnabled = false
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.parse:parse-android:+'
implementation 'com.parse.bolts:bolts-android:1.+'
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-ads:+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.+'
implementation 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
implementation 'com.commit451:PhotoView:1.2.4'
}
And here's my build.gradle (Project: appname):
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// 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" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The Build is successful, but the app crashes at startup.
EDIT:
It doesn't build successful anymore now, it throws this absolutely weird error in the Build message console:
AGPBI: {"kind":"error","text":"Program type already present: com.google.android.gms.location.places.zza","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'
.
Try adding this dependency to your gradle file:
implementation 'com.android.support:multidex:1.0.3'
Also you should use the same versions for the support and play services libraries. And you should avoid using "+" for latest version. Change this part:
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-ads:+'
into this:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
EDIT: You may also add this part to your app level gradle file and try again. I did not see anyone tried this but it may work.
allprojects {
repositories {
//...
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "12.0.1"
}
}
}
}
}
2ND UPDATE: Just seen this, the dependency below, covers all the others, then it may cause a duplication issue. Remove the other dependencies and leave this one:
implementation 'com.google.android.gms:play-services:12.0.1'
I had the same issue and I solved it.Update all your com.google.android.gms:play-services dependencies to 15.0.0. It should look like this:
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services:15.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
Once you do that, it should fix the issue with finding the NoClassDefFoundError error (at least it did for me).
That worked for me I added subprojects block as below to my project gradle file
allprojects {
repositories {
//...
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "+"
}
if (details.requested.group == 'com.google.firebase'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "+"
}
}
}
}
}
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services:15.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
This helped me.
You may be using different verions of libraries.
Important point is you may be using an external library which is using a different play services version (may be older) . Please check care fully all external libraries updates and match them all
I solved it by removing
implementation "com.google.android.gms:play-services:$play_service_version"
and keeping only important dependencies.
In my case I had
implementation "com.google.android.gms:play-services:$play_service_version"
implementation "com.google.android.gms:play-services-location:$play_service"
And I removed
implementation "com.google.android.gms:play-services:$play_service_version"
and kept
implementation "com.google.android.gms:play-services-location:$play_service"
Here play_service_version & play_service are versions
I had exactly the same problem. I tried quite a few things, but here's what actually helped.
I added this to my project:
implementation 'com.google.android.gms:play-services-base:16.0.1'.
The error went away.
Then I removed it. Everything was still fine. Cleaned the project - still no error.
Don't ask me for logic behind this, it just worked for me, that's all I know.
#cubycode I am also running into the same issue and I tried all solutions listed here.
I received the same error even with the 'zzbq;' at the end
In app build.gradle I had to update my com.google.firebase:firebase-core to 16.0.1 to match the same line in the react-native-firebase build.gradle
Example:
app/build.gradle
implementation 'com.google.firebase:firebase-core:16.0.1'
react-native-firebase/android/build.gradle
compileOnly "com.google.firebase:firebase-core:16.0.1"
Step 1:
This kind of error throw the some logs. Read it carefully to find out which dependency cause this issue
Step 2:
Update that dependency to latest version.
For ex: In my case it throw the error in material design dependency. I just update that dependency to latest version - problem solved
My error log - Didn't find class "com.google.android.material.tabs........"

Failed to resolve: recyclerview-v7

While adding dependency implementation 'com.azoft.carousellayoutmanager:carousel:1.2.4' to my project, Android Studio throws exception Failed to resolve: recyclerview-v7. Then I tried adding dependency for recyclerview. Still getting same error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.someapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
implementation 'com.commonsware.cwac:saferoom:0.4.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
I have same problem and i'm change order of repositories in biuld.gradle (app) and problem solved.
Change :
jcenter()
google()
To :
google()
jcenter()
Hope it's help
In Android Studio go to build.gradle (Project: YourProjectName), NOT the build.gradle (Module: app)
Change the code, so it looks like this (switch google() and jcenter()):
allprojects {
repositories {
google()
jcenter()
}
}
Add maven to repositories and it should work
I have no idea why. But my exact same problem has been solved with commenting all of android support dependencies.
It's so strange. But now my project runs without adding another version of these dependencies. When I put only one of these dependencies, I have a warning between ver 27.1.1 and 28.0.0 of support libraries. But I've only used version 28 on this project. It means there is all of these dependencies somewhere in the gradle which obviously is not written by me, or may be it's in the sth like cache (So strange bug).
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-vector-drawable:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
If any of the above solutions did not work try to remove Maven repository and resync again.
this line in build.gradle
maven {
url "https://storage.googleapis.com/snap-kit-build/maven"
}
That's work for me in some projects.
Or replace this line
'com.android.support:recyclerview-v7:27.....'
With this line
'com.android.support:recyclerview-v7:28.0.0-alpha3'
That will solve your problem.
It cannot resolve because the version you are adding might not be in the Maven repository. Check your Api level and choose the appropriate version.
This link might be of help.
Finally I found a solution. Upgrading all the support dependencies to the latest version, solved the issue. You can check the latest version of dependencies here. I upgraded the support dependencies to the latest version 28.0.0-alpha3. It solved my problem.
I had the same error Failed to resolve: recyclerview-v7. Even though project worked before and I just moved it to another machine without changes in gradle files.
Full clear of gradle service folder helped me. By default it is located in C:\Users\username\.gradle
I closed Android Studio and deleted that folder. After that gradle made clean sync and it ended with success.
Maybe deleting of only cached libraries in C:\Users\username\.gradle\caches\modules-2\files-2.1\com.android.support\recyclerview-v7 would help but I didn't check it.
You have to exclude recyclerview-v7 module from the library you want to add:
compile ('YOUR_DEPENDENCY') {
exclude module: 'recyclerview-v7'
}
You have to use for example this dependency: implementation 'com.android.support:recyclerview-v7:28.0.0' in your build.gradle(Module: app) and use 'sync project with Gradle Files' then it will get this dependency. It should work then.
in androidx version I added implementation "androidx.recyclerview:recyclerview:1.1.0" to my gradle and it solved the issue

Android 3.1.1 - Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;

since I've updated to Android Studio 3.1, my project is not running anymore. I have searched for a solution all over the internet with no positive results.
Here's the error I get in the Logcat:
--------- beginning of crash
04-13 13:33:55.466 12720-12720/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: woopy.domain.com.woopy, PID: 12720
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/base.apk"],nativeLibraryDirectories=[/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
at android.app.ActivityThread.-wrap1(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
04-13 13:33:55.567 12720-12727/? I/zygote: Debugger is no longer active
Here's my build.gradle (Module:app) file:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "woopy.domain.com.woopy"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
aaptOptions {
cruncherEnabled = false
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.parse:parse-android:+'
implementation 'com.parse.bolts:bolts-android:1.+'
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-ads:+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.+'
implementation 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
implementation 'com.commit451:PhotoView:1.2.4'
}
And here's my build.gradle (Project: appname):
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// 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" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The Build is successful, but the app crashes at startup.
EDIT:
It doesn't build successful anymore now, it throws this absolutely weird error in the Build message console:
AGPBI: {"kind":"error","text":"Program type already present: com.google.android.gms.location.places.zza","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'
.
Try adding this dependency to your gradle file:
implementation 'com.android.support:multidex:1.0.3'
Also you should use the same versions for the support and play services libraries. And you should avoid using "+" for latest version. Change this part:
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-ads:+'
into this:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
EDIT: You may also add this part to your app level gradle file and try again. I did not see anyone tried this but it may work.
allprojects {
repositories {
//...
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "12.0.1"
}
}
}
}
}
2ND UPDATE: Just seen this, the dependency below, covers all the others, then it may cause a duplication issue. Remove the other dependencies and leave this one:
implementation 'com.google.android.gms:play-services:12.0.1'
I had the same issue and I solved it.Update all your com.google.android.gms:play-services dependencies to 15.0.0. It should look like this:
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services:15.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
Once you do that, it should fix the issue with finding the NoClassDefFoundError error (at least it did for me).
That worked for me I added subprojects block as below to my project gradle file
allprojects {
repositories {
//...
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "+"
}
if (details.requested.group == 'com.google.firebase'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "+"
}
}
}
}
}
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services:15.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
This helped me.
You may be using different verions of libraries.
Important point is you may be using an external library which is using a different play services version (may be older) . Please check care fully all external libraries updates and match them all
I solved it by removing
implementation "com.google.android.gms:play-services:$play_service_version"
and keeping only important dependencies.
In my case I had
implementation "com.google.android.gms:play-services:$play_service_version"
implementation "com.google.android.gms:play-services-location:$play_service"
And I removed
implementation "com.google.android.gms:play-services:$play_service_version"
and kept
implementation "com.google.android.gms:play-services-location:$play_service"
Here play_service_version & play_service are versions
I had exactly the same problem. I tried quite a few things, but here's what actually helped.
I added this to my project:
implementation 'com.google.android.gms:play-services-base:16.0.1'.
The error went away.
Then I removed it. Everything was still fine. Cleaned the project - still no error.
Don't ask me for logic behind this, it just worked for me, that's all I know.
#cubycode I am also running into the same issue and I tried all solutions listed here.
I received the same error even with the 'zzbq;' at the end
In app build.gradle I had to update my com.google.firebase:firebase-core to 16.0.1 to match the same line in the react-native-firebase build.gradle
Example:
app/build.gradle
implementation 'com.google.firebase:firebase-core:16.0.1'
react-native-firebase/android/build.gradle
compileOnly "com.google.firebase:firebase-core:16.0.1"
Step 1:
This kind of error throw the some logs. Read it carefully to find out which dependency cause this issue
Step 2:
Update that dependency to latest version.
For ex: In my case it throw the error in material design dependency. I just update that dependency to latest version - problem solved
My error log - Didn't find class "com.google.android.material.tabs........"

Categories

Resources