All projects build successfully but
I'm getting this error when I try to run or debug the project.
error:
Android resource linking failed W/ziparchive( 6524): Zip: didn't find
signature at start of lfh, offset=41550366 error: failed to open APK:
Invalid offset.
I did try to build, clean, rebuild
Invalidate cashes restart
sync project with Gradle files
update Gradle, android studio to the latest version
my Build.gradle app :
apply plugin: 'com.android.application'
android {
defaultConfig {
applicationId "com.geesdsada.app"
minSdkVersion 17
targetSdkVersion 28
versionCode 4
versionName "4.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
defaultConfig {
multiDexEnabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
}
dependencies {
//fonts
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//CounterFAB
implementation 'com.github.andremion:counterfab:1.0.1'
//
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.stripe:stripe-android:6.1.2'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.0.1'
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'io.paperdb:paperdb:2.1'
//add libraries
implementation 'me.zhanghai.android.materialratingbar:library:1.3.2'
implementation 'com.stepstone.apprating:app-rating:2.0.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'io.paperdb:paperdb:2.1'
implementation 'com.github.rey5137:material:1.2.4'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
implementation 'com.parse:parse-android:1.16.3'
//update version to the latest one
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation 'com.squareup.picasso:picasso:2.5.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
all code is finely written and was working well, but suddenly this error showed up.
I was getting this in Android Studio and all I did to fix it was go to "Build" > "Clean Project" and it just worked. Now Rebuild (Build -> Rebuild) your project.
Related
I am using Android Studio 4.0.1. The following error occurs when I try to produce a debug version of the program. (No problem to produce a release version!)
Create Debug Version
ERROR
Entry name 'javax/annotation/CheckReturnValue.java' collided
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
//apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ai"
minSdkVersion 19
targetSdkVersion 28
versionCode 6
versionName "0.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix '.dev'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.kailashdabhi:om-recorder:1.1.5'
implementation 'com.fxn769:musicwave:1.0'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'
// implementation "androidx.viewpager2:viewpager2:1.0.0"
//firebase
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
// implementation 'com.google.firebase:firebase-perf:19.0.5'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.GrenderG:Toasty:1.4.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.github.amirdew:JSON:v1.0.0'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.github.ohoussein.playpauseview:playpauseview:1.0.2'
implementation 'com.nabinbhandari.android:permissions:3.7'
implementation 'com.job:droidnet:2.0.0'
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
}
I cleaned the project and even rebuild it but the problem remains.
Deleting the existing apk from the debug folder and rebuilding the apk should work.
In my app where I use firebase, firebase-ui, google maps, among others, it worked perfectly. I want to update to the latest version of each library and install Firebase Performance.
The error I get is:
error: cannot access InternalTokenProvider
class file for com.google.firebase.internal.InternalTokenProvider not found
And when I click on this error it sends me to an Activity to this line:
auth = FirebaseAuth.getInstance();
Here's my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
signingConfigs {
release {
//signin things
}
}
compileSdkVersion 28
defaultConfig {
applicationId "app.example.asd"
minSdkVersion 21
targetSdkVersion 28
versionCode 22
versionName "2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-perf:17.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation "com.google.firebase:firebase-auth:16.0.1"
implementation 'com.firebaseui:firebase-ui:4.3.2'
implementation 'com.facebook.android:facebook-login:4.42.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-places:16.1.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
implementation 'com.facebook.android:facebook-share:4.42.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//kt y rxjava
implementation 'androidx.core:core-ktx:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5#aar'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
//lib en kt
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
Can anyone detect where the problem is in my dependencies? Thank you
UPDATE
With Peter's help I was able to correct the error, changing from firebase-auth:16.0.1 to firebase-auth:17.0.0.
Now I'm getting another error when I install and open my app, this is it:
java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (3.0.0). Please report to firebase-database-client#google.com
at com.google.firebase.database.android.AndroidPlatform$1$1.run(com.google.firebase:firebase-database##16.0.5:98)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListener;
The error appears the first time I use this line in my app:
myRef = FirebaseDatabase.getInstance().getReference();
It looks like you are pulling in com.google.firebase:firebase-database:16.0.5 via the dependency on com.firebaseui:firebase-ui:4.3.2 (https://github.com/firebase/FirebaseUI-Android/releases/tag/4.3.2)
Try adding this to your build.gradle:
implementation 'com.google.firebase:firebase-database:17.0.0'
Also, generally check you are using the latest versions, which can be found at https://firebase.google.com/docs/android/setup#available-libraries
NOTE: This is based on the new error in your update after changing from firebase-auth:16.0.1 to firebase-auth:17.0.0
Change this:
implementation 'com.google.firebase:firebase-auth:16.0.1'
Into this:
implementation 'com.google.firebase:firebase-auth:17.0.0'
Upgrade everything(Firebase Auth, Cloud, etc) to the latest versions by just hovering mouse over it.
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
or:
implementation 'com.google.firebase:firebase-analytics:17.4.1'
implementation 'com.google.firebase:firebase-database:19.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.1'
Sync to this version and see.
If not, upgrade the Firebase tools on Android Studio.
When I try use issue from GitHub. I give in out
Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'.
I try use Material Calendar View
My gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.mederov.timelord"
minSdkVersion 15
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 JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.applandeo:material-calendar-view:1.5.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
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'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
}
In the later gradle versions compile was replaced with both api and implementation.
api exposes the dependencies to external modules, just like compile does. So if you have module A depends on module B which depends on C, if C changes, then A needs to be recompiled. The Gradle team recognized this was unnecessary in a lot of cases, so it introduced implementation so if C changes only modules that depend on it will have to recompile, which means only module B. This shortens build times and makes the project much more tidy.
In short, if you replace all compile with api the result will be the same and that's what the warning is hitting at.
However, as a rule of thumb you'd want to use implementation whenever possible to avoid polluting the project with dependencies.
I'd try to first replace compile with implementation and build the project.
This link has a much better explanation and visualization of the differences.
You can change this line compile 'com.applandeo:material-calendar-view:1.5.1'
to this implementation 'com.applandeo:material-calendar-view:1.5.1'
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example.speakplease"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation ('com.google.apis:google-api-services-translate:v2-rev47-
1.22.0')
implementation 'com.google.cloud:google-cloud-translate:0.5.0'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.4'
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'
compileOnly 'com.google.dagger:dagger-parent:2.9'
//noinspection GradleDependency
annotationProcessor 'com.google.auto.value:auto-value:1.2'
}
apply plugin: 'com.google.gms.google-services'
I have imported google translation api and after that I started getting Annotation error. I am able resolve it but not getting this error. I am aware of it that some dependencies are clashing but unable to find out.
Here is the error.
Program type already present:
com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream
Message{kind=ERROR, text=Program type already present:
com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream,
sources=[Unknown source file], tool name=Optional.of(D8)}
This is what happens when your 2 dependencies include the same dependency. Check out this question to find out how to see which dependency is causing the issue.
I have had the same problem, for me it was ExoPlayer, cause It was included in a 3rd party library I was using, and I included it by itself also.
I don't know for sure which 2 are in conflict for you, but these seem suspiciously "related":
implementation ('com.google.apis:google-api-services-translate:v2-rev47-1.22.0')
implementation 'com.google.cloud:google-cloud-translate:0.5.0'
I am trying to build an application in Android and I tried using the FirebaseUI, but I am getting this error:
error: cannot access zzeuq
class file for com.google.android.gms.internal.zzeuq not found
Here is my gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.vanillatalk.vanillatalk"
minSdkVersion 21
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'
compile 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
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'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
}
apply plugin: 'com.google.gms.google-services'
I think that the error is related to missmatched versions of firebase, since it 11.6.0 and firebase-ui-database:4.0.0, but I cannot seem to find the correct versions for the firebase-ui-database that would match the 11.6.0?
Could anyone help?
If you want to use version 4.0 of firebase ui you need to update firebase dependencies:
implementation 'com.google.firebase:firebase-database:16.0.1'
For version 11.6.0 of firebase you should use version 3.x.x of Firebase UI, see this.
You have to use all latest library dependency to use
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
Now I checked that when I use firebase-database:15.0.1 library it's doesn't let me do syn properly.
Use the latest version of all other library dependency, I'm it will be work.
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
Or you can try to find firebase-database:11.6.0 this version similar FirebaseUi library. But it's hard to found.
Thanks.