Android Studio 3.0 after rebuilding Duplicate zip entry warnings - android

After rebuiding my Java/Kotlin project I have got lot of warnings in Gradle console. How can I remove the warnings?
I try packagingOptions in my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.eusecom.samfantozzi"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE-FIREBASE.txt'
//duplicate files copied in apk meta-inf/rxjava
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/MANIFEST.MF'
exclude '1.jar:META-INF/MANIFEST.MF'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
def daggerVer = 2.11
implementation "com.google.dagger:dagger:$daggerVer"
implementation "com.google.dagger:dagger-android-support:$daggerVer"
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVer"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVer"
//kotlin drawer
implementation 'co.zsmb:materialdrawer-kt:1.1.1'
//anko dsl
implementation "org.jetbrains.anko:anko-common:$anko_version"
compile "org.jetbrains.anko:anko-sdk15:$anko_version"
compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
compile "org.jetbrains.anko:anko-design:$anko_version"
compile "org.jetbrains.anko:anko-recyclerview-v7:$anko_version"
//Firebase
//Firebase Authentication email password
implementation 'com.google.firebase:firebase-auth:9.6.0'
//Firebase database
implementation 'com.firebaseui:firebase-ui-database:0.4.0'
implementation 'com.google.firebase:firebase-database:9.6.0'
//picasso
implementation 'com.squareup.picasso:picasso:2.5.0'
//retrofit2
implementation 'com.google.code.gson:gson:2.6.2'
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.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.squareup.okhttp:okhttp:2.4.0'
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex:rxandroid:1.2.0'
// libs like rxbinding + rxjava-math haven't been ported to RxJava 2.x yet, so this helps
implementation "com.github.akarnokd:rxjava2-interop:0.6.1"
implementation 'io.reactivex:rxjava-math:1.0.0'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
implementation 'com.jakewharton.rxbinding:rxbinding:0.2.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
In my project/build.gradle
buildscript {
ext.kotlin_version = '1.1.3-2'
ext.anko_version = '0.8.2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Related

solve error: cannot access Publisher in Android Studio?

I am getting this error while compilation of my code:
Can anyone help me how to solve this error or what might be causing this error?
Edit1: Gradle file of the project . And also the error log is attached with the question above.please check it.
import com.google.gms.googleservices.GoogleServicesPlugin
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.veblr.videomate"
minSdkVersion 21
targetSdkVersion 28
versionCode 16
versionName "1.0.0.8"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
aaptOptions.cruncherEnabled = true
aaptOptions.useNewCruncher = false
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
buildTypes {
debug {
jniDebuggable true
multiDexEnabled true
}
release {
minifyEnabled false
///shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
//Other parameters
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
ext {
roomVersion = '1.0.0'
archLifecycleVersion = '1.1.0'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/XXX'
exclude 'META-INF/license/LICENSE.base64.txt'
exclude 'META-INF/rxjava.properties'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
jumboMode true
preDexLibraries = false
javaMaxHeapSize "12g" //specify the heap size for the dex process
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven{ url "https://adcolony.bintray.com/AdColony"}
maven { url 'https://maven.fabric.io/public'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.adcolony:sdk:3.3.0'
implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.firebase:firebase-measurement-connector-
impl:17.0.5"
//noinspection GradleCompatible
implementation 'com.google.ads.mediation:facebook:4.27.0.0'
implementation 'com.facebook.android:audience-network-sdk:4.27.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.danikula:videocache:2.7.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
implementation 'com.android.support:multidex:1.0.3'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'
// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'android.arch.navigation:navigation-fragment:1.0.0-rc02'
implementation 'android.arch.navigation:navigation-ui:1.0.0-rc02'
}
apply plugin: 'com.google.gms.google-services'
GoogleServicesPlugin.config.disableVersionCheck = true
apply plugin: 'digital.wup.android-maven-publish'
I think there is some problem with the java compiler and java sdk if so ,please let me know if that's the problem and how to solve it .
Make sure in your project gradle buildscript you use latest version:
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
And also try to update version of your libraries use latest version:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.adcolony:sdk:3.3.0'
implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.firebase:firebase-measurement-connector-impl:17.0.5"
//noinspection GradleCompatible
implementation 'com.google.ads.mediation:facebook:4.27.0.0'
implementation 'com.facebook.android:audience-network-sdk:4.27.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.danikula:videocache:2.7.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
implementation 'com.android.support:multidex:1.0.3'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'
// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
}
Run it with --stacktrace or --info or --debug to see more log outputs information from the terminal for example: ./gradlew compileDebugJavaWithJavac --debug.
You wi be able to see more info on when and where it stopped the task and why it failed.
in my case the Publisher class was belong to the RxJava library which was missing from my project so adding these two lines in my app/gradle file fixed the problem:
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.x.x'
Try to update latest versions:
RxJava: io.reactivex.rxjava2:rxjava
RxAndroid: io.reactivex.rxjava2:rxandroid
Then, AndroidStudio -> File -> invalidate Cashes/Restart.
It helped me.
There is problem with 'com.google.firebase:firebase-core:16.0.8' library , when I upgraded it in app/gradle , it solved the problem for me.

library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1

When syncing the project this error is appearing:
The library com.google.android.gms:play-services-basement is being
requested by various other libraries at [[15.0.1,15.0.1]], but
resolves to 16.0.1.
Disable the plugin and check your dependencies tree using ./gradlew
:app:dependencies.
This is my build.gradle Project file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my build.gradle app file:
import com.google.gms.googleservices.GoogleServicesPlugin
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
multiDexEnabled true
applicationId "com.example.myexampleapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 13
versionName "0.1.13"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.android.gms:play-services-auth:16.0.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'
}
apply plugin: 'com.google.gms.google-services'
What I have tried:
Following these instructions: com.google.android.gms:play-services-measurement-base is being requested by various other libraries
Updating all kinds of libraries to the newest versions
Thank you for your help!
Update:
This is what I currently have in my dependencies:
dependencies {
api "com.android.support:appcompat-v7:28.0.0"
api "com.android.support:customtabs:28.0.0"
api "com.android.support:support-v4:28.0.0"
api "com.android.support:cardview-v7:28.0.0"
api "com.android.support:design:28.0.0"
api "com.android.support.constraint:constraint-layout:1.1.3"
api "com.crashlytics.sdk.android:crashlytics:2.9.5"
api "com.google.android.gms:play-services-base:16.0.1"
api "com.google.android.gms:play-services-auth:16.0.1"
api "com.google.firebase:firebase-core:16.0.5"
api "com.google.firebase:firebase-auth:16.0.5"
api ("com.google.firebase:firebase-firestore:17.1.2") {
exclude group: "com.squareup.okhttp", module: "okhttp"
}
api ("com.firebaseui:firebase-ui-firestore:4.1.0") {
exclude group: "com.google.code.gson", module: "gson"
}
api ("com.firebaseui:firebase-ui-auth:4.1.0") {
exclude group: "com.google.code.gson", module: "gson"
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
And this is the error that I am getting:
error: cannot find symbol class IFlagProvider
these dependencies make it build:
dependencies {
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:customtabs:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.android.gms:play-services-auth:16.0.1"
implementation "com.crashlytics.sdk.android:crashlytics:2.9.5"
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.firebase:firebase-auth:16.0.4"
implementation ("com.google.firebase:firebase-firestore:18.0.0") {
exclude group: "com.squareup.okhttp", module: "okhttp"
exclude group: "com.google.code.gson", module: "gson"
// exclude group: "com.google.guava", module: "guava"
}
implementation ("com.firebaseui:firebase-ui-firestore:4.1.0") {
exclude group: "com.google.code.gson", module: "gson"
}
implementation ("com.firebaseui:firebase-ui-auth:4.1.0") {
exclude group: "com.google.code.gson", module: "gson"
}
}
I've added customtabs:28.0.0 to meet the required version and play-services-base:16.0.0 (which should be fetched as transitive dependency). also excluded duplicate packages, eg. gson. used compileSdkVersion and targetSdkVersion 28.

java.io.IOException Error in Android studio when using the Lottie files

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mashitha.smartwaterbottle"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
repositories {
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.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:support-annotations:27.1.1'
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.jjoe64:graphview:4.2.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'me.itangqi.waveloadingview:library:0.3.5'
//Google play services
implementation 'com.google.android.gms:play-services:11.4.0'
implementation 'com.google.firebase:firebase-database:11.4.0'
implementation 'com.google.firebase:firebase-storage:11.4.0'
implementation 'com.google.firebase:firebase-auth:11.4.0'
implementation 'com.google.android.gms:play-services-auth:11.4.0'
implementation 'pub.devrel:easypermissions:0.3.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev328-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.airbnb.android:lottie:2.5.5'
compile 'com.android.volley:volley:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
when I add the "implementation 'com.airbnb.android:lottie:2.5.5'", I'm getting this error:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [C:\Users\Pavan\AndroidStudioProjects\Others Projects\And_Stu_app\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Pavan.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.1.aar\bfd8b5be8898d98e8c2045ba6c6ace43\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
What is the reason for that?
You should check the supportLibrary versions. It's probably due to a conflict in the versions. Either you in your code or Lottie's library is using a different supportLibrary version.
Interim fix can be to change the version to be same on both ends, or you could use exclude function of Gradle. for example -
implementation ('com.airbnb.android:lottie:2.5.5'){
exclude group: ‘com.android.support’, module: ‘support-v4’
exclude group: ‘com.android.support’, module: ‘appcompat-v7’
exclude group: ‘com.android.support’, module: ‘recyclerview-v7’
exclude group: ‘com.android.support’, module: ‘design’
}
OR you could declare a Gradle configuration to exclude all support dependencies from 3rd party libraries, by adding this in your build.gradle -
configurations {
all*.exclude module: ‘appcompat-v7’
all*.exclude module: ‘support-v4’
}

org.apache.http.ContentTooLongException Message{kind=ERROR, text=Program type already present: org.apache.http.ContentTooLongException

Program type already present: org.apache.http.ContentTooLongException
Message{kind=ERROR, text=Program type already present: org.apache.http.ContentTooLongException, sources=[Unknown source file], tool name=Optional.of(D8)
}
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.sample.io.sos"
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'
}
}
buildToolsVersion '28.0.0'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies {
compileOnly 'javax.annotation:jsr250-api:1.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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-alpha3'
implementation 'com.android.support:design:28.0.0-alpha3'
implementation 'com.judemanutd:autostarter:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "com.squareup.retrofit2:retrofit:2.4.0"
implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.squareup.retrofit:retrofit:1.6.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'org.parceler:parceler-api:1.1.10'
annotationProcessor 'org.parceler:parceler:1.1.10'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'io.swagger:swagger-annotations:1.5.15'
implementation 'io.gsonfire:gson-fire:1.8.0'
implementation 'org.threeten:threetenbp:1.3.5'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.apache.httpcomponents:httpcore:4.4.4"
implementation "org.apache.httpcomponents:httpmime:4.5.2"
implementation "org.apache.httpcomponents:httpclient-android:4.3.3"
implementation "com.android.volley:volley:1.1.0"
testImplementation "org.robolectric:robolectric:3.0"
testImplementation "net.jodah:concurrentunit:0.4.2"
testImplementation "junit:junit:4.12"
}
Can not solve this problem. Here i'm using swagger generated android java code in my project. That relevant implementations are added.
Swagger providing sdk for older version (compileSdkVersion 25). Still they didn't updated that sdk. But i want to developing for latest version 28. Also there are more version incompatible issues on that sdk.
And i reported that problem in github.
Swagger issues
I am working for SDK version 22 and my comppiledsdk version is 27 .It gives me same error.Any pointers to share?
Gradle-
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.hp.mayukhapp"
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.constraint:constraint-layout:1.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.sendgrid:sendgrid-java:4.0.1'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
compile group: 'com.pkmmte.view', name: 'circularimageview', version: '1.0'
compile 'com.mostafagazar:customshapeimageview:1.0.4'
compile 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.pedroSG94.vlc-example-streamplayer:pedrovlc:2.5.14'
implementation 'com.rvirin.onvif:onvifcamera:1.1.8'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
// compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
// compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:design:27.1.0'
compile 'com.google.android.gms:play-services:11.0.2'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
}
repositories {
mavenCentral()
}

Getting apt error while upgrading to gradle 3.0 version in android studio 3.0

I want to update my project to run in android studio 3.0. While updating I'm getting an error with apt. I changed my complete build.gradle means all compile to implementation. Here is my build.gradle file.
Here is my error:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
Here is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.sample"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
configurations{
all*.exclude module: 'servlet-api'
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.0.2'
}
}
}
dependencies {
implementation project(':androidHorizontalListView')
implementation project(':library')
implementation project(':simpl3r')
implementation 'com.google.code.gson:gson:2.2.4'
implementation files('libs/acra-4.5.0.jar')
implementation files('libs/bugsense-3.6.jar')
implementation files('libs/espresso-1.1-bundled.jar')
implementation files('libs/sample-2.4.1.jar')
implementation files('libs/signpost-commonshttp4-1.2.1.1.jar')
implementation files('libs/signpost-core-1.2.1.1.jar')
implementation files('libs/twitter4j-core-4.0.2.jar')
implementation files('libs/universal-image-loader-1.9.2-SNAPSHOT-with-sources.jar')
implementation files('libs/volley.jar')
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation files('libs/gcm.jar')
implementation files('libs/mint-5.2.1.jar')
implementation project(':swipelibrary')
implementation files('libs/glide-3.7.0.jar')
implementation files('libs/glide-3.7.0-javadoc.jar')
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'org.mozilla:rhino:1.7.7'
implementation 'info.guardianproject.netcipher:netcipher:1.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.thefinestartist:utils:0.9.1'
apt 'com.thefinestartist:compilers:0.9.1'
implementation 'com.android.support:recyclerview-v7:26.0.2'
implementation 'in.srain.cube:grid-view-with-header-footer:1.0.12'
implementation 'joda-time:joda-time:2.9.2'
implementation 'com.writingminds:FFmpegAndroid:0.3.2'
//implemented retrofit.
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.google.android.gms:play-services-analytics:10.2.1'
implementation 'com.facebook.android:facebook-android-sdk:4.26.0'
implementation 'com.android.support:design:26.0.2'
implementation 'com.flurry.android:analytics:6.3.1'
implementation project(':sample-chat')
implementation 'com.quickblox:quickblox-android-sdk-core:3.1.0'
implementation "com.google.android.gms:play-services-gcm:10.2.1"
implementation project(':sample-core')
}
You enable annotation processing via this answer, then you can delete the line
apply plugin: 'com.neenbedankt.android-apt'
and replace
apt 'com.thefinestartist:compilers:0.9.1'
with
annotationProcessor 'com.thefinestartist:compilers:0.9.1'
1) Remove below line from your project's build.gradle file:
apply plugin: 'com.neenbedankt.android-apt'
2) Replace : apt 'com.thefinestartist:compilers:0.9.1'
with
annotationProcessor 'com.thefinestartist:compilers:0.9.1'
3) Go to your gradle.properties write the below code and sync your project:
android.enableAapt2=false
for resolving com.android.tools.aapt2.Aapt2Exception: AAPT2 error

Categories

Resources