I've googled and searched in here the solution for this but haven't found it. I just updated my Android Studio to 3.0 and I'm trying to port my app to use feature modules in order to be able to make an Instant App, but when I try to run the app from Android Studio, I get the following error:
Error:Execution failed for task
':app:transformClassesWithStackFramesFixerForDebug'.
> com.android.build.api.transform.TransformException:
java.lang.RuntimeException: java.lang.RuntimeException:
java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.builder.utils.FileCache$FileCreatorException:
java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF
I tried to exclude such file using packagingOptions, but apparently is not working. Here are my build.gradle files:
Project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
compileSdkVersion = 26
supportLib = '26.1.0'
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
App module build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven { url "https://s3.amazonaws.com/avocarrot-android-builds/dist" }
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.myapp.mobile"
minSdkVersion 16
targetSdkVersion 26
versionCode 23004003
versionName "4.0.0.3"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/MANIFEST.MF'
}
}
dependencies {
def mopub = '4.16.0#aar'
def avocarrot = '4.6.0'
def exoplayer = 'r2.2.0'
def mobfox = '3.2.3'
def pubnative = '2.0.4'
def facebook = '4.+'
def pubnativeFacebookAdapter = '2.0.2-4.22.1'
def taboola = '1.3.1'
def okhttp = '3.8.1'
def okio = '1.13.0'
def picasso = '2.5.2'
def firebase = '11.4.0'
def playServices = '11.4.0'
def supportLib = '26.1.0'
def gson = '2.8.1'
def circleimageview = '2.1.0'
def floatingactionbutton = '1.3.0'
def mpAndroidChart = 'v3.0.2'
def gridViewHeaderFooter = '1.0.12'
def multidex = '1.0.1'
def floatingsearchview = '2.0.3'
def cropper = '1.0.1#aar'
def adapterdelegates = '3.0.1'
def rxjava = '2.x.y'
def rxandroid = '2.0.1'
def rxjavaAdapter = '2.3.0'
def retrofit = '2.3.0'
def rxbinding = '2.0.0'
def diagonallayout = '1.0.6'
def fabSpeedDial = '1.0.6'
def butterknife = '8.7.0'
def sqlbrite = '2.0.0'
def leakcanary = '1.5.1'
def debugDB = '1.0.1'
def crashlytics = '2.6.8#aar'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
implementation files('libs/libAdapterSDKMoPub.jar')
implementation files('libs/AdMobMediationAdapter.jar')
implementation files('libs/lsmsdkadmobmediationadapter.jar')
implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
implementation files('libs/gcm.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/comscore.jar')
implementation files('libs/hmediaLib-1.3.0.jar')
implementation(name:'adux-1.0.0', ext:'aar')
implementation "com.avocarrot.sdk:mediation-sdk-nativead:$avocarrot"
implementation "com.google.android.exoplayer:exoplayer:$exoplayer"
implementation "com.facebook.android:audience-network-sdk:$facebook"
implementation "com.facebook.android:facebook-android-sdk:$facebook"
implementation "com.google.ads.mediation:facebook:$facebook"
implementation "com.github.mobfox:MobFox-Android-SDK-Core:$mobfox"
implementation "net.pubnative:sdk:$pubnative"
implementation "net.pubnative:sdk.adapter.facebook:$pubnativeFacebookAdapter"
implementation "com.squareup.okhttp3:okhttp:$okhttp"
implementation "com.squareup.okio:okio:$okio"
implementation "com.squareup.picasso:picasso:$picasso"
implementation "com.android.support:cardview-v7:$rootProject.supportLib"
implementation "com.android.support:support-v4:$rootProject.supportLib"
implementation "com.android.support:recyclerview-v7:$rootProject.supportLib"
implementation "com.android.support:design:$rootProject.supportLib"
implementation "com.android.support:customtabs:$rootProject.supportLib"
implementation "com.google.android.gms:play-services-analytics:$playServices"
implementation "com.google.android.gms:play-services-ads:$playServices"
implementation "com.google.android.gms:play-services-wearable:$playServices"
implementation "com.google.code.gson:gson:$gson"
implementation "de.hdodenhof:circleimageview:$circleimageview"
implementation "com.melnykov:floatingactionbutton:$floatingactionbutton"
implementation "com.github.PhilJay:MPAndroidChart:$mpAndroidChart"
implementation "in.srain.cube:grid-view-with-header-footer:$gridViewHeaderFooter"
implementation "com.android.support:multidex:$multidex"
implementation "com.github.arimorty:floatingsearchview:$floatingsearchview"
implementation "com.soundcloud.android:android-crop:$cropper"
implementation "com.hannesdorfmann:adapterdelegates3:$adapterdelegates"
implementation "io.reactivex.rxjava2:rxjava:$rxjava"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rxjavaAdapter"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp"
implementation "com.jakewharton.rxbinding2:rxbinding:$rxbinding"
implementation "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbinding"
implementation "com.github.florent37:diagonallayout:$diagonallayout"
implementation "io.github.yavski:fab-speed-dial:$fabSpeedDial"
implementation "com.google.firebase:firebase-messaging:$firebase"
implementation "com.jakewharton:butterknife:$butterknife"
implementation "com.squareup.sqlbrite2:sqlbrite:$sqlbrite"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife"
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
debugImplementation "com.amitshekhar.android:debug-db:$debugDB"
implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics")
{
transitive = true
}
implementation(name: 'DebugSettings', ext: 'aar')
wearApp project(':wear')
implementation project(':myapp-base')
}
apply plugin: 'com.google.gms.google-services'
Base module build.gradle
apply plugin: 'com.android.feature'
repositories {
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion '26.0.2'
baseFeature true
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api "com.android.support:appcompat-v7:$rootProject.supportLib"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
application project(':app')
}
You're including the libs directory twice in your app's build.gradle
// Once
implementation fileTree(include: ['*.jar'], dir: 'libs')
// And once more, but more verbose
implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
implementation files('libs/libAdapterSDKMoPub.jar')
implementation files('libs/AdMobMediationAdapter.jar')
implementation files('libs/lsmsdkadmobmediationadapter.jar')
implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
implementation files('libs/gcm.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/comscore.jar')
implementation files('libs/hmediaLib-1.3.0.jar')
This could be where your issue originates. Decide on one way to include these and let me know whether that works.
Related
When activating proguard (minifyEnabled = true) in my gradle configuration, the build fails in the step:
:app:uploadCrashlyticsMappingFileRelease
the returned error is: java.io.IOException: Crashlytics could not read proxy port string
With minifyEnabled = false the app builds and runs correctly.
My gradle file (app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.appdistribution'
apply plugin: 'io.objectbox'
apply plugin: 'realm-android'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 32
defaultConfig {
applicationId project.getProperties().get('application_id')
minSdkVersion 23
targetSdkVersion 32
versionCode Integer.parseInt(project.getProperties().get('version_code'))
versionName project.getProperties().get('version_name')
vectorDrawables.useSupportLibrary = true
resValue 'string', 'application_name', project.getProperties().get('application_name')
resValue 'string', 'application_id', project.getProperties().get('application_id')
multiDexEnabled true
}
signingConfigs {
release {
storeFile file('../' + project.getProperties().get('store_file'))
storePassword project.getProperties().get('store_password')
keyAlias project.getProperties().get('key_alias')
keyPassword project.getProperties().get('key_password')
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.release
}
release {
debuggable true
minifyEnabled true
shrinkResources false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
firebaseAppDistribution {
releaseNotes = generateChangeLogShort()
testers = "john.doe#gmail.com"
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// KTX
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// Needed for https://github.com/FirebaseExtended/flutterfire/issues/4651
implementation 'androidx.browser:browser:1.4.0'
// Firebase bug workaround for emulator, as described here: https://stackoverflow.com/questions/64668851/why-the-firestore-isnt-working-on-android-studio
implementation "io.grpc:grpc-okhttp:1.44.1"
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:30.1.0')
// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-functions'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.firebaseui:firebase-ui-storage:6.2.1'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.android:flexbox:1.1.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.maps.android:android-maps-utils:0.6.2'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.kbeanie:multipicker:1.5#aar'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'io.michaelrocks:libphonenumber-android:8.10.7'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.google.firebase:firebase-config:21.1.0'
// Navigation:
def nav_version = "2.5.0"
// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Places library
implementation 'com.google.android.libraries.places:places:2.6.0'
// PING Place Picker
implementation project(path: ':pingplacepicker')
//Wheel Picker
implementation 'com.super_rabbit.wheel_picker:NumberPicker:1.0.1'
kapt 'com.github.bumptech.glide:compiler:4.12.0'
}
def generateChangeLogShort(){
println "Generating release notes"
def releaseNotes = ""
def lastTagHash = "git rev-list --tags --skip=1 --max-count=1".execute().text.trim()
println lastTagHash
def lastTag = "git describe --abbrev=0 --tags $lastTagHash".execute().text.trim()
println lastTag
def cmdLine = "git log $lastTag..head --pretty=format:\"%s\""
def procCommit = cmdLine.execute()
procCommit.in.eachLine { line ->
//Remove surrounding quotation marks generated by the git log command
def escapedLine = line.substring(1, line.length() - 1)
//Escape backslashes
escapedLine = escapedLine.replaceAll(/(\\)/, "\\/")
//Escape quotation marks
escapedLine = escapedLine.replaceAll('"', '\\\\"')
//if (escapedLine.startsWith("feat:")) {
releaseNotes += escapedLine + "\n"
//}
}
println releaseNotes
return releaseNotes
}
gradle file (project):
buildscript {
ext {
kotlin_version = '1.6.21'
}
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
def nav_version = '2.4.1'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
classpath 'io.realm:realm-gradle-plugin:10.10.1'
classpath 'io.objectbox:objectbox-gradle-plugin:2.9.1'
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
allprojects {
repositories {
mavenCentral()
google()
maven {
url 'https://maven.google.com/'
}
maven { url 'https://jitpack.io' }
jcenter()
}
}
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
jcenter()
}
The error stack trace:
Caused by: java.io.IOException: Crashlytics could not read proxy port string.
at com.google.firebase.crashlytics.buildtools.api.net.proxy.DefaultProxyFactory.create(DefaultProxyFactory.java:38)
at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.sendFile(RestfulWebApi.java:91)
at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.uploadFile(RestfulWebApi.java:119)
at com.google.firebase.crashlytics.buildtools.api.FirebaseMappingFileService.uploadMappingFile(FirebaseMappingFileService.java:44)
at com.google.firebase.crashlytics.buildtools.Buildtools.uploadMappingFile(Buildtools.java:208)
at com.google.firebase.crashlytics.buildtools.Buildtools$uploadMappingFile$5.call(Unknown Source)
at com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask.uploadMappingFile(UploadMappingFileTask.groovy:63)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
... 114 more
UPDATE:
Found out that issue is that the Crashlytics mapping file can't be uploaded because the proxy settings are not set in the Androdi Studio environment. But no proxy is being used, so have no idea what to specify for:
systemProp.https.proxyPort
systemProp.https.proxyHost
I am currently working on recyclerview adapter. I can not work further because my autocomplete/code analyzer is apparently not working. I need it to generate the implementation of Recyclerview.Adapter automatically. please help me..
I have a hunch that the problem was caused by my gradle configuration. FYI, everything works fine before i resync my gradle (module). here is my current gradle configuration:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.toharifqi.myfavoritesports"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.github.bumptech.glide:glide:$glide_version"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.okhttp3:logging-interceptor:$logging_interceptor_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"
}
and this is my gradle configuration for project level:
buildscript {
ext.kotlin_version = "1.4.10"
ext.appcompat_version = "1.1.0"
ext.core_ktx_version = "1.3.2"
ext.constraint_version = "2.0.4"
ext.legacy_support_version = "1.0.0"
ext.junit_version = "4.13.1"
ext.androidx_junit_version = "1.1.2"
ext.espresso_version = "3.3.0"
ext.multidex_version = "2.0.1"
ext.cardview_version = "1.0.0"
ext.recyclerview_version = "1.1.0"
ext.material_version = "1.2.1"
ext.glide_version = "4.12.0"
ext.room_version = "2.2.5"
ext.retrofit_version = "2.9.0"
ext.logging_interceptor_version = '4.9.0'
ext.kotlin_coroutines_version = "1.3.9"
ext.lifecycle_version = "2.2.0"
ext.koin_version = "2.1.6"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have just found the problem, it was caused by my android core ktx version. previously it was implementation 'androidx.core:core-ktx:1.5.0'. After I changed to implementation 'androidx.core:core-ktx:1.3.2' everything works fine. thank you
My project has two modules i.e. app and moduleX.
app project is mostly built on Java and moduleX is completly in Kotlin.
While creating "debug" build, it's running fine but when I try to create release build i.e. devRelease, it give following error-
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDevRelease'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.compat.R$attr
Here is the app level build.gradle-
apply plugin: 'com.android.application'
apply plugin: 'com.facebook.testing.screenshot'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.appname"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner rootProject.ext.testInstrumentationRunner
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
versionNameSuffix "-dev"
applicationIdSuffix ".dev"
}
qa {
dimension "environment"
versionNameSuffix "-test"
applicationIdSuffix ".test"
}
staging {
dimension "environment"
versionNameSuffix "-staging"
applicationIdSuffix ".staging"
}
prod {
dimension "environment"
}
}
signingConfigs {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
release {
storeFile file("keystore/appname_keystore.jks")
storePassword properties.getProperty('storePassword')
keyAlias properties.getProperty('keyAlias')
keyPassword properties.getProperty('keyPassword')
}
}
buildTypes {
debug {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
bundle {
language {
enableSplit = false
}
}
configurations.all {
resolutionStrategy {
// force certain versions of dependencies (including transitive)
force 'com.squareup.okhttp3:okhttp:' + okHttpLibVersion
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// Dagger dependency for DI
implementation 'com.google.dagger:dagger:2.16'
annotationProcessor "com.google.dagger:dagger-compiler:2.16"
compileOnly 'javax.annotation:jsr250-api:1.0'
implementation 'javax.inject:javax.inject:1'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Memory leaks
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
//Others
implementation rootProject.ext.parceler
annotationProcessor rootProject.ext.parcelerAnnotationProcessor
implementation rootProject.ext.lombok
annotationProcessor rootProject.ext.lombokAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
// Fingerprint Auth
implementation 'com.multidots:fingerprint-auth:1.0.1'
//Module Projects
api project(':energyswitchcui')
}
screenshots {
multipleDevices true
}
and here is the build.gradle file of moduleX-
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
// need separate runner for facebook screenshot test in module
testInstrumentationRunner 'com.appname.SnapshotTestRunner'
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
}
qa {
dimension "environment"
}
staging {
dimension "environment"
}
prod {
dimension "environment"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.intuit.sdp:sdp-android:1.0.6'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Others
implementation rootProject.ext.parceler
kapt rootProject.ext.parcelerAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}
repositories {
mavenCentral()
}
// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
multipleDevices true
}
This is the project level build.gradle file-
apply from: 'dependencies.gradle'
buildscript {
ext.kotlinVersion = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is dependencies.gradle-
ext {
//Android
minSdkVersion = 24
targetSdkVersion = 28
compileSdkVersion = targetSdkVersion
testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
androidSupportLibVersion = "28.0.0"
okHttpLibVersion = "3.14.0"
//Unit testing
junit = "junit:junit:4.12"
androidTestRunner = "com.android.support.test:runner:1.0.2"
espresso = "com.android.support.test.espresso:espresso-core:3.0.2"
mockito = "org.mockito:mockito-all:1.10.19"
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"
supportTestRules = "com.android.support.test:rules:1.0.2"
//Support Library & UI
constraintLayout = "com.android.support.constraint:constraint-layout:1.1.3"
supportCompatV7 = "com.android.support:appcompat-v7:$androidSupportLibVersion"
supportDesign = "com.android.support:design:$androidSupportLibVersion"
supportCardView = "com.android.support:cardview-v7:$androidSupportLibVersion"
supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
glide = "com.github.bumptech.glide:glide:3.7.0"
// RxJava lib
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
//Retrofit
retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"
//Others
parceler = "org.parceler:parceler-api:1.1.6"
parcelerAnnotationProcessor = "org.parceler:parceler:1.1.6"
lombok = "org.projectlombok:lombok:1.16.16"
lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"
}
I have already tried many answers i.e.
Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior
but nothing is working here.
Hi i have come up with the solution and run successful below gradles with just little version changes:
Main Project Level Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
//Android
minSdkVersion = 24
targetSdkVersion = 28
compileSdkVersion = targetSdkVersion
testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
androidSupportLibVersion = "28.0.0"
androidCompatVersion = "1.0.0-beta01"
androidCardViewVersion = "1.0.0"
constraintlayoutVersion = "1.1.3"
okHttpLibVersion = "3.14.0"
//Unit testing
junit = "junit:junit:4.12"
androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
supportTestRules = "com.android.support.test:rules:1.0.2"
//Support Library & UI
constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
supportDesign = "com.android.support:design:$androidSupportLibVersion"
supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
glide = "com.github.bumptech.glide:glide:3.7.0"
mockito = "org.mockito:mockito-all:1.10.19"
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"
// RxJava lib
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
//Retrofit
retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"
//Others
parceler = "org.parceler:parceler-api:1.1.9"
parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
lombok = "org.projectlombok:lombok:1.16.16"
lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"
}
App Level gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.gradletest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
androidTestImplementation rootProject.ext.supportTestRules
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
implementation rootProject.ext.parceler
// annotationProcessor rootProject.ext.parcelerAnnotationProcessor
implementation rootProject.ext.lombok
annotationProcessor rootProject.ext.lombokAnnotationProcessor
//Memory leaks
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.multidots:fingerprint-auth:1.0.1'
implementation project(':energyswitchcui')
}
Module("energyswitchcui") gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.intuit.sdp:sdp-android:1.0.6'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Others
implementation rootProject.ext.parceler
// kapt rootProject.ext.parcelerAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
multipleDevices true
}
Below are the errors that were encountered during gradle and what i have done to solve it:
1) Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Solution: put below lines under android section of app level gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2) Error: The given artifact contains a string literal with a package reference 'android.support.v4.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.
Solution: Removed "annotationProcessor rootProject.ext.parcelerAnnotationProcessor" from app level gradle and updated this library in main level gradle under "ext" section from 1.1.6 to 1.1.9 'parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"'
but it does not worked
So i removed that library and successfully build gradle and also can run the project. Here is the dropbox link you can find project on :https://www.dropbox.com/s/ki8gpfdaxh0dzo3/GradleTest.zip?dl=0
3) Above solution will work only in debug mode but in release build we have to also remove this two libraries to build successfully in release build:
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"
When I am try to compile my application ,the error shows
Program type already present: com.google.thirdparty.publicsuffix.TrieParser
Message{kind=ERROR, text=Program type already present: com.google.thirdparty.publicsuffix.TrieParser, sources=[Unknown source file], tool name=Optional.of(D8)}
Is there any issue in my gradle files?
My project level bulid.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
/* classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'*/
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext.googlePlayServicesVersion = '11.4.0'
ext.supportLibraryVersion = '27.0.1'
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
subprojects {
tasks.withType(Javadoc).all { enabled = false }
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app level build.gradle is
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
/*maven {
url 'http://sdk.uxcam.com/android/' //commented can be used later
}*/
}
/*
apply plugin: 'com.neenbedankt.android-apt'
*/
android {
lintOptions {
disable "ResourceType"
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
applicationId 'com.wedviser.matrimony'
minSdkVersion 19
targetSdkVersion 27
versionCode 31
versionName "2.0.1"
vectorDrawables.useSupportLibrary = true
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
manifestPlaceholders = [HOCKEYAPP_APP_ID: "cbb545807562491aaafac6118c9116a6"]
}
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/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
flavorDimensions 'default'
productFlavors {
development {
dimension 'default'
minSdkVersion 19
applicationId 'com.wedviser.matrimony.dev'
targetSdkVersion 27
versionCode 56
versionName '1'
}
production {
dimension 'default'
minSdkVersion 19
applicationId 'com.wedviser.matrimony'
targetSdkVersion 27
versionCode 57
versionName '2.1.8'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':mobicomkitui')
implementation('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
// for development only .need to remove for releasing //
// implementation 'net.hockeyapp.android:HockeySDK:4.1.4'
implementation files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
// Account Kit
//implementation 'com.uxcam:uxcam:2.5.9#aar' // commented can be used later
implementation 'com.google.android.gms:play-services-analytics:15.0.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.0.4'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.opalox.rangebarvertical:rangebarvertical:1.1'
implementation 'me.itangqi.waveloadingview:library:0.3.2'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.github.Raizlabs.DBFlow:dbflow-core:4.0.0-beta5'
implementation 'com.github.Raizlabs.DBFlow:dbflow:4.0.0-beta5'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
implementation 'com.mcxiaoke.viewpagerindicator:library:2.4.1#aar'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'net.danlew:android.joda:2.9.9'
implementation 'com.github.aryarohit07:picasso-facedetection-transformation:0.3.0'
implementation 'com.tuyenmonkey:mkloader:1.2.0'
implementation 'org.parceler:parceler-api:1.1.9'
/* implementation 'com.google.android.gms:play-services-gcm:15.0.1'*/
implementation 'com.github.toanvc:floatingactionmenu:0.8.9'
implementation 'com.github.drawers:SpinnerDatePicker:1.0.4'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
api 'com.github.Raizlabs.DBFlow:dbflow-processor:4.0.0-beta5'
api 'org.parceler:parceler:1.1.9'
implementation files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
}
apply plugin: 'com.google.gms.google-services'
Also I have used applozic chat platform.
And the mobicomkitui build.gradle is
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "5.8.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
api 'com.google.code.gson:gson:2.8.0'
api 'com.google.firebase:firebase-messaging:15.0.2'
api 'com.google.android.gms:play-services-maps:15.0.1'
api 'com.google.android.gms:play-services-location:15.0.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
api 'com.android.support:design:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.android.support:cardview-v7:27.1.1'
api project(':mobicomkit')//Note: use this for customization
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
//api 'com.applozic.communication.message:mobicomkit:5.8.5' //Note: use this in case customization is not required
}
/* ext {
// Where you will see your artifact in Bintray's web interface
// The "bintrayName" should match the name of the Bintray repro.
bintrayRepo = 'maven'
bintrayName = 'applozic-communication-uiwidget'
// Maven metadata
publishedGroupId = 'com.applozic.communication.uiwidget'
libraryName = 'mobicomkitui'
// Save yourself a head ache, and set this equal to the name of the Android Studio library
// module. The artifact name needs to match the name of the library.
artifact = 'mobicomkitui'
libraryDescription = 'Applozic Communication UI Widget'
libraryVersion = '5.8.5'
developerId = 'devashish'
developerName = 'Applozic'
developerEmail = 'devashish.mamgain#gmail.com'
}
apply from: 'https://raw.githubusercontent.com/attwellBrian/JCenter/master/installv1.gradle'
apply plugin: 'com.jfrog.bintray'
version = libraryVersion
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false // add this line
source = android.sourceSets.main.java.srcDirs
//source = android.sourceSets.main.allJava
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
// Optional. The passphrase for GPG signing'
// gpg {
// sign = true //Determines whether to GPG sign the files. The default is false
// passphrase = properties.getProperty("bintray.gpg.password")
//}
}
}
}*/
Maybe late, but i found an Answer so there it is :
com.google.thirdparty.publicsuffix.TrieParser is part of Guava, and so it may be included in multiple libraries.
In this case, there is at least org.parceler which include guava.
To fix this compilation problem, you have to change the way you import org.parceler, and include it like this :
implementation "org.parceler:parceler-api:1.1.12"
compileOnly "org.parceler:parceler:1.1.12"
annotationProcessor "org.parceler:parceler:1.1.12"
Source : https://github.com/johncarl81/parceler/issues/182
After the update of supportVersion to 27.0.0 ONLY on Android 5.0.2 the app crash with this stacktrace:
W/WindowManager: Failed looking up window
java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W#f004691 does not exist
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8426)
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8417)
at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2558)
at com.android.server.wm.Session.remove(Session.java:186)
at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:2920)
at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5390)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3223)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Both on the device and on the emulator.
If I put 26.0.2 as supportVersion, the app still works normally as usual.
UPDATE
The problem persist with supportVersion 27.0.1
UPDATE 2
Project gradle
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.fabric.tools:gradle:1.24.2'
}
}
plugins {
id "com.diffplug.gradle.spotless" version "3.6.0"
}
allprojects {
repositories {
google()
jcenter()
jcenter { url = 'http://dl.bintray.com/swrve-inc/android' }
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://maven.localytics.com/public' }
maven { url 'http://dl.bintray.com/teads/TeadsSDK-android' }
maven { url 'http://maven.apptimize.com/artifactory/repo' }
maven { url 'https://comscore.bintray.com/Analytics' }
}
}
ext {
//APPLICATION
compileSdkVersion = 27
buildToolsVersion = '27.0.1'
minSdkVersion = 19
targetSdkVersion = 27
//LIBRARIES
timberVersion = '4.6.0'
guavaVersion = '20.0'
multidexVersion = '1.0.2'
supportVersion = '27.0.1'
constraintVersion = '1.0.2'
playServiceVersion = '11.4.0'
commonLangVersion = '3.5'
jacksonVersion = '2.4.2'
appsFlyerVersion = '4.7.1'
facebookAudienceVersion = '4.26.1'
facebookSkdVersion = '4.26.0'
facebookAdapterVersion = '4.26.1.0'
flurryVersion = '6.9.2'
googleTrackingVersion = '2.2.4'
crashliticsVersion = '2.6.8'
swrveVersion = '4.10.1'
swrveLocationVersion = '1.3'
pubnativeVersion = '2.0.5'
localyticsVersion = '4.3.1'
teadsVersion = '2.4.13'
oguryPresageVersion = '2.1.21'
evernoteAndroidJobVersion = '1.1.11'
apptimizeVersion = '2.13.5'
comScoreVersion = '5.5.1'
bottomBarVersion = '2.3.1'
rxJavaVersion = '2.1.6'
rxAndroidVersion = '2.0.1'
//TEST LIBRARIES
testsVersion = '1.0.1'
espressoVersion = '3.0.1'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powermockVersion = '1.6.6'
robolectricVersion = '3.5'
assertjVersion = '1.2.0'
//PUBNATIVE ADAPTERS
pnFlurryVersion = '6.9.2'
pnAdmobVersion = '9.6.1'
}
App gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.diffplug.gradle.spotless'
spotless {
kotlin {
target "**/*.kt"
ktlint()
}
}
def versionMajor = 8
def versionMinor = 8
def versionPatch = 8
def versionBuild = 8
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
flavorDimensions "std"
defaultConfig {
dimension "std"
applicationId "xxx.yyy.zzz"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode versionMajor * 1000 + versionMinor * 100 + versionPatch * 10 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
//APP VERSION NAME
buildConfigField "String", "VERSION_NAME_PREFIX", "\"zzzz\""
//MARKET CONFIG
buildConfigField "String", "MARKET_NAME", "\"GooglePlay\""
buildConfigField "String", "MARKET_ENDPOINT", "\"market://details?id=\""
buildConfigField "String", "MARKET_BACKOFF_ENDPOINT", "\"https://play.google.com/store/apps/details?id=\""
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
....
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
release {
minifyEnabled true
proguardFiles 'acb.txt'
zipAlignEnabled true
}
}
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds true
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
fatal 'StopShip'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
//CORE LIB
implementation "com.jakewharton.timber:timber:${rootProject.ext.timberVersion}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
implementation "com.google.guava:guava:${rootProject.ext.guavaVersion}"
implementation "com.android.support:multidex:${rootProject.ext.multidexVersion}"
implementation "com.android.support:multidex-instrumentation:${rootProject.ext.multidexVersion}"
implementation "com.android.support:design:${rootProject.ext.supportVersion}"
implementation "com.android.support:cardview-v7:${rootProject.ext.supportVersion}"
implementation "com.android.support.constraint:constraint-layout:${rootProject.ext.constraintVersion}"
implementation "com.google.android.gms:play-services-identity:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-base:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-analytics:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-gcm:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-location:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-maps:${rootProject.ext.playServiceVersion}"
implementation "com.google.android.gms:play-services-ads:${rootProject.ext.playServiceVersion}"
implementation "org.apache.commons:commons-lang3:${rootProject.ext.commonLangVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${rootProject.ext.jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-core:${rootProject.ext.jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${rootProject.ext.jacksonVersion}"
implementation "io.reactivex.rxjava2:rxjava:${rootProject.ext.rxJavaVersion}"
implementation "io.reactivex.rxjava2:rxandroid:${rootProject.ext.rxAndroidVersion}"
//SDK
implementation "com.appsflyer:af-android-sdk:${rootProject.ext.appsFlyerVersion}#aar"
implementation "com.facebook.android:facebook-android-sdk:${rootProject.ext.facebookSkdVersion}"
implementation "com.facebook.android:audience-network-sdk:${rootProject.ext.facebookAudienceVersion}"
implementation "com.flurry.android:analytics:${rootProject.ext.flurryVersion}"
implementation "com.flurry.android:ads:${rootProject.ext.flurryVersion}"
implementation files("libs/GoogleConversionTrackingSdk-${rootProject.ext.googleTrackingVersion}.jar")
implementation("com.crashlytics.sdk.android:crashlytics:${rootProject.ext.crashliticsVersion}#aar") {
transitive = true
}
//TEADS VIDEO
implementation("tv.teads.sdk:androidsdk:${rootProject.ext.teadsVersion}:fullRelease#aar") {
transitive = true
}
//OGURY - PRESAGE
implementation files("libs/presage-lib-${rootProject.ext.oguryPresageVersion}-obfuscated.jar")
//PUBNATIVE
implementation "net.pubnative:sdk:${rootProject.ext.pubnativeVersion}"
//PUBNATIVE - ADAPTERS
implementation "net.pubnative:sdk.adapter.admob:${rootProject.ext.pnAdmobVersion}"
implementation "net.pubnative:sdk.adapter.flurry:${rootProject.ext.pnFlurryVersion}"
//ADMOB - ADAPTERS
implementation "com.google.ads.mediation:facebook:${rootProject.ext.facebookAdapterVersion}"
//SWRVE PLOT
implementation "com.swrve.sdk.android:swrve-google:${rootProject.ext.swrveVersion}"
implementation(name: "swrve-location-${rootProject.ext.swrveLocationVersion}", ext: "aar")
//LOCALYTICS
implementation "com.localytics.android:library:${rootProject.ext.localyticsVersion}"
//JOB
implementation "com.evernote:android-job:${rootProject.ext.evernoteAndroidJobVersion}"
//APPTIMIZE
implementation "com.apptimize:apptimize-android:${rootProject.ext.apptimizeVersion}"
//COMSCORE
implementation "com.comscore:android-analytics:${rootProject.ext.comScoreVersion}"
//BOTTOM BAR
implementation "com.roughike:bottom-bar:${rootProject.ext.bottomBarVersion}"
//TEST
androidTestImplementation "com.android.support:support-annotations:${rootProject.ext.supportVersion}"
androidTestImplementation "com.android.support.test:runner:${rootProject.ext.testsVersion}"
androidTestImplementation "com.android.support.test:rules:${rootProject.ext.testsVersion}"
androidTestImplementation "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:${rootProject.ext.espressoVersion}"
androidTestImplementation("com.android.support.test.espresso:espresso-contrib:${rootProject.ext.espressoVersion}") {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude module: 'recyclerview-v7'
}
testImplementation "junit:junit:${rootProject.ext.junitVersion}"
testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoVersion}"
testImplementation "org.powermock:powermock-api-mockito:${rootProject.ext.powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${rootProject.ext.powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${rootProject.ext.powermockVersion}"
testImplementation "org.powermock:powermock-classloading-xstream:${rootProject.ext.powermockVersion}"
testImplementation "org.robolectric:robolectric:${rootProject.ext.robolectricVersion}"
testImplementation "org.robolectric:shadows-multidex:${rootProject.ext.robolectricVersion}"
testImplementation "org.robolectric:shadows-httpclient:${rootProject.ext.robolectricVersion}"
testImplementation "com.android.support:support-annotations:${rootProject.ext.supportVersion}"
testImplementation "com.squareup.assertj:assertj-android:${rootProject.ext.assertjVersion}"
}
apply plugin: 'com.google.gms.google-services'
In my case it was due to the AppCompatActivity extend for the start activity, When it changed to Activity it is working fine!
You can try adding: maven { url "https://maven.google.com" }
Also set your support version to 27+
This has helped me in previous instance. Not tried it with 27.0.0 or 27.0.1
I know this is not the preferred approach but it can be used as a temporary fix. Wether you want to use it or ignore it, I leave it to you. But let me know if it works.