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'
Related
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.
Whenever i build my project in android studio it gives me the following error
Program type already present: com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
below is my build.gradle file
lastly the line that has implementation 'com.android.support:design:27.0.0' also gives an error saying...
All com.android.support libraries must use the exact same version specification
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.iwatchug"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.0.0'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services:7+'
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'
}
repositories {
google()
}
apply plugin: 'com.google.gms.google-services'
Remove the following line:
implementation 'com.google.android.gms:play-services:7+'
From the docs:
Note: Don't use the combined play-services target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.
You need to add specific google play services library, example:
implementation 'com.google.android.gms:play-services-vision:17.0.2'
Ever since the update, I keep getting the following error when I build. I have tried clean and build but the error persists:
This is the error I get when I try to build:
Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
The problem seems to be related to an issue with xmlbeans-2.6.0.jar, however I don't really understand what's it trying to do by "dexingTransform". Do I need to add anything to my gradle to support my project after the update?
This is my build.grade:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "app.testApp"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:multidex:1.0.3'
implementation "org.apache.poi:poi:3.17"
implementation "org.apache.poi:poi-ooxml:3.17"
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
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'
}
and the following reported errors that I cannot understand, which are coming up after the update:
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Caused by: org.gradle.api.artifacts.transform.ArtifactTransformException: Failed to transform file 'xmlbeans-2.6.0.jar' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=26} using transform DexingTransform
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
Ok, I have figured out what the problem was. Turns out after updating to gradle 4.4, you'll get an error if you have duplicate library references in your project. In my case, this was xmlbeans-2.6.0.jar, and I had the following dependencies clashing with each other:
implementation "org.apache.poi:poi:3.17"
implementation "org.apache.poi:poi-ooxml:3.17"
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
So in my case I kept the following, and commented out the rest:
//implementation "org.apache.poi:poi:3.17"
//implementation "org.apache.poi:poi-ooxml:3.17"
//implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
I then re-synced gradle, clean and build the project, and my issue was resolved.
I'm using Android Studio. I have two modules: the app (UI) and a library. When tested separately, both compile and work as they should, but when I try to use some of the library classes on the app, I can't build the project. I get this error:
Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
My library build.gradle has just a few lines:
apply plugin: 'java-library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.poi:poi-ooxml:3.17'
}
sourceCompatibility = "7"
targetCompatibility = "7"
Then my app's build.gradle is this
android {
compileSdkVersion 28
defaultConfig {
applicationId "skrb.appprueba"
minSdkVersion 21
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
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:design:28.0.0'
implementation project(path: ':coreLib')
}
When adding this (implementation project(path: ':coreLib'), I get the error and I don't know how to solve it.
Things that I tried:
Cleaning and rebuilding the project.
Setting multiDexEnabled to true
according to the error message, it should rather be:
implementation (project(path: ":coreLib")) {
exclude group: "org.apache.xmlbeans"
}
Try this one:
implementation(project(path: ':coreLib')) {
exclude module: 'poi'
exclude module: 'poi-ooxml'
}
Here you could find more information why this error happen.
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.