generate singed apk failed - android

when i update as to 3.6, there is an exception when i ./gradlew assembleRelease. and the infomation is like this
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:minifyReleaseWithR8'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
...
Caused by: java.lang.NullPointerException
at com.android.tools.r8.naming.A.a(:7)
at com.android.tools.r8.naming.A.c(:1)
at com.android.tools.r8.naming.w.a(:71)
at com.android.tools.r8.naming.w.a(:54)
at com.android.tools.r8.naming.w.a(:61)
at com.android.tools.r8.naming.w.a(:61)
at com.android.tools.r8.naming.w.a(:29)
at com.android.tools.r8.naming.G.a(:25)
...
my project gradle is
buildscript {
ext.kotlin_version = '1.3.61'
apply from:'config.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
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
classpath 'com.meituan.android.walle:plugin:1.1.6'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven { url "https://jitpack.io" }
}
}
my app gradle is
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'walle'
def dep = rootProject.ext.dependencies
def and = rootProject.ext.android
android {
compileSdkVersion and.compileSdkVersion
buildToolsVersion and.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
applicationId and.appid
minSdkVersion and.minSdkVersion
targetSdkVersion and.targetSdkVersion
versionCode 215005
versionName '3.0'
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'armeabi'
}
manifestPlaceholders = [
JPUSH_PKGNAME : ,
JPUSH_APPKEY : ' ',
JPUSH_CHANNEL : ' ',
]
}
signingConfigs {
release {
keyAlias ' '
keyPassword ' '
storeFile file('./release-key.keystore')
storePassword ' '
v1SigningEnabled true
v2SigningEnabled true
}
debug {
keyAlias ' '
keyPassword ' '
storeFile file('. ')
storePassword ' '
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
buildConfigField('boolean', 'ISRELEASE', '${IS_RELEASE}')
}
release {
debuggable false
minifyEnabled true
shrinkResources true
zipAlignEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField('boolean', 'ISRELEASE', '${IS_RELEASE}')
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
encoding = 'UTF-8'
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation dep.eventbus
implementation dep.immersionbar
implementation dep.immersionbarfragment
implementation dep.SmartRefreshLayout
// implementation dep.networking
implementation project(':android-networking')
// implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'
//glide
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation dep.glide
implementation 'com.github.bumptech.glide:okhttp3-integration:4.9.0'
implementation 'androidx.annotation:annotation:1.1.0'
annotationProcessor 'androidx.annotation:annotation:1.1.0'
implementation dep.rxjava2
implementation dep.okhttp3
implementation dep.rxandroid
implementation dep.rxbinding2
implementation project(':qmui')
implementation project(':arch')
implementation project(':emoji')
implementation project(':reclib-qq')
implementation 'com.facebook.stetho:stetho:1.1.1'
//flowLayout
implementation(project(':flowlayout-lib')) {
transitive = true
exclude group: 'androidx.appcompat', module: 'appcompat'
}
implementation dep.multidex
implementation dep.banner
implementation dep.toast
implementation dep.brvah
implementation dep.gson
implementation dep.baseadapter
//webview
api dep.agentweb
api 'com.just.agentweb:filechooser:4.1.2'//
api 'com.download.library:Downloader:4.1.2'//
implementation dep.picker_view
implementation dep.picker_picture
// api dep.aliyun
implementation 'com.amap.api:3dmap:7.0.0'
implementation 'com.amap.api:location:4.7.2'
implementation 'com.amap.api:search:6.9.2'
/**kotlin*/
implementation "androidx.core:core-ktx:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//utils
implementation 'com.blankj:utilcode:1.25.9'
//tablayout//https://github.com/H07000223/FlycoTabLayout
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2#aar'
//butter knife
implementation "com.jakewharton:butterknife:$butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
// api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.5.7'
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.3.1'
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
implementation 'com.kingja.loadsir:loadsir:1.3.6'
/*lottie*/
implementation('com.airbnb.android:lottie:3.2.0') { exclude group: 'com.androidx' }
implementation 'cn.jiguang.sdk:jmessage:2.9.0' //
implementation 'cn.jiguang.sdk:jcore:2.2.2' //
implementation project(':reclib-testemoticons')
implementation 'cn.jiguang.sdk:jpush:3.4.0' //
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'com.github.mtotschnig:StickyListHeaders:2.7.1'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.yanzhenjie:permission:2.0.3'
debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:3.0_beta2'
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:3.0_beta2'
// api project(path: ':LibEasyGlide')
implementation 'com.binioter:guideview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//bugly
implementation 'com.tencent.bugly:crashreport:3.1.7'
implementation 'com.tencent.bugly:nativecrashreport:3.7.1'
implementation 'com.meituan.android.walle:library:1.1.6'
implementation "com.google.android.material:material:$materialVersion"
api project(path: ':LibEasyGlide')
}
the bottom is some dependencies, it all Commonly used library . when my android studio is 3.5.4,it work well, but when i update to 3.6 it build failed. i have no idea with this problem
and the gradle.properties is
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

If you are use new NDK then try to add below code in gradle.properties (Project properties)
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.enableD8=true
android.bundle.enableUncompressedNativeLibs=false

Related

Crashlytics mapping file upload fails on Android Studio with minifyEnabled

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

Android :app:processReleaseResources Android resource linking failed

I am getting this error while running the app.
Here are the Gradle files for my project.
build.gradle
buildscript {
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.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
}
build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
signingConfigs {
'release' {
storeFile file('/Users/jeetraval/Documents/Workspace/my-audio-app-android/test.jks')
keyAlias 'key0'
storePassword 'Test#123'
keyPassword 'Test#123'
}
}
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.jeet.myaudio"
minSdkVersion 25
targetSdkVersion 31
versionCode 5
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
signingConfig signingConfigs.release
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
/*applicationVariants.all { variant ->
renameAPK(variant)
}*/
}
}
dataBinding {
enabled = true
}
dexOptions {
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "default"
productFlavors {
prod {
versionName "1.0.3"
resValue "string", "app_name", "MyAudio"
}
}
}
dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.4.1'
//noinspection GradleCompatible
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
//noinspection GradleCompatible
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'cn.carbs.android:AvatarImageView:1.0.4'
// testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
// androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-ads:20.6.0'
// Room
implementation 'androidx.room:room-runtime:2.2.2'
kapt 'androidx.room:room-compiler:2.2.2'
kapt "com.android.databinding:compiler:3.1.4"
// Test helpers for Room
testImplementation 'androidx.room:room-testing:2.2.2'
implementation 'com.kovacorp.vocalizesdk:VocalizeSDK:0.0.7'
implementation "com.google.assistant.appactions:suggestions:1.0.0"
}
The distribution URL which I used in gradle-wrapper.properties is as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
I have checked all the res files. But there is no error in any files. Please suggest any approach to solve this. Thanks in advance.

android kotlin multiplatform kotlinx.serialization works on debug but does not work on release version

We are making our next project in the company with kotlin multiplatform. Everything worked fine until I tried to create a release version for android to beta test. I got this error in release versions while everything works fine in debug.
[NetworkManager] unknown exception: l.a.w: Can't locate argument-less serializer for class a. For generic classes, such as lists, please provide serializer explicitly.
here this is project level build.gradle
buildscript {
ext.kotlin_version = '1.3.70'
ext.versions = [
"ktor" : "1.3.2",
"serialization" : "0.20.0",
"coroutines" : "1.3.6",
]
repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://dl.google.com/dl/android/maven2' }
maven { url "https://s3-eu-west-1.amazonaws.com/elasticode-sdk/Android/maven/" }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.70' // or any other kotlin plugin
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.70'
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
maven { url "https://s3-eu-west-1.amazonaws.com/elasticode-sdk/Android/maven/" }
google()
jcenter()
}
}
and this is common modules build.gradle
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlinx-serialization'
kotlin {
targets {
iosArm64("ios64")
iosX64("iosSim")
configure([
ios64,
iosSim
]) {
binaries.framework {
baseName = 'PassengerCommon'
}
}
fromPreset(presets.jvm, 'android')
}
sourceSets {
commonMain.dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${versions.serialization}"
implementation "io.ktor:ktor-client:${versions.ktor}"
implementation "io.ktor:ktor-client-json:${versions.ktor}"
implementation "io.ktor:ktor-client-serialization:${versions.ktor}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${versions.coroutines}"
}
iosMain {
dependsOn commonMain
iosSimMain.dependsOn(it)
ios64Main.dependsOn(it)
dependencies {
// HTTP
implementation "io.ktor:ktor-client-ios:${versions.ktor}"
implementation "io.ktor:ktor-client-json-native:${versions.ktor}"
implementation "io.ktor:ktor-client-serialization-native:${versions.ktor}"
// Coroutines
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${versions.coroutines}"
}
}
iosSimMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-iosx64:${versions.serialization}"
}
}
ios64Main {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-iosarm64:${versions.serialization}"
}
}
androidMain.dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${versions.serialization}"
implementation "io.ktor:ktor-client-serialization-jvm:${versions.ktor}"
implementation "io.ktor:ktor-client-okhttp:${versions.ktor}"
implementation "com.squareup.okhttp3:logging-interceptor:4.0.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}"
}
}
// Create a task building a fat framework.
task debugFatFramework(type: FatFrameworkTask) {
// The fat framework must have the same base name as the initial frameworks.
baseName = 'PassengerCommon'
// The default destination directory is '<build directory>/fat-framework'.
destinationDir = file("$buildDir/fat-framework/debug")
// Specify the frameworks to be merged.
from(
targets.ios64.binaries.getFramework("DEBUG"),
targets.iosSim.binaries.getFramework("DEBUG")
)
}
// Create a task building a fat framework.
task releaseFatFramework(type: FatFrameworkTask) {
// The fat framework must have the same base name as the initial frameworks.
baseName = 'PassengerCommon'
// The default destination directory is '<build directory>/fat-framework'.
destinationDir = file("$buildDir/fat-framework/release")
// Specify the frameworks to be merged.
from(
targets.ios64.binaries.getFramework("RELEASE"),
targets.iosSim.binaries.getFramework("RELEASE")
)
}
}
configurations {
compileClasspath
}
lastly this is the android modules build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'
repositories {
flatDir {
dirs 'libs'
}
google()
mavenCentral()
}
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 28
defaultConfig {
applicationId "com.lines.passenger"
minSdkVersion 21
targetSdkVersion 28
versionCode 53
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
signingConfigs {
release {
try {
storeFile file('../keystores/release.jks')
storePassword *****
keyAlias "*****"
keyPassword *****
} catch (Exception ex) {
throw new Exception("You should define KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
}
}
debug {
storeFile file('../keystores/debug.keystore')
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
buildTypes {
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
resValue("string", "app_name", "Passenger")
signingConfig signingConfigs.debug
resValue("string", "g_maps_api_key", "*****")
manifestPlaceholders = [MAPS_API_KEY: "*****"]
resValue "string", "app_version", "${defaultConfig.versionName}"
resValue("string", "PUSHER_APP_KEY", "*****")
resValue("string", "new_relic_key", "*****")
}
release {
resValue "string", "app_version", "${defaultConfig.versionName}"
minifyEnabled true
shrinkResources true
zipAlignEnabled true
resValue("string", "app_name", "Lines")
signingConfig signingConfigs.release
resValue("string", "g_maps_api_key", "*****")
manifestPlaceholders = [MAPS_API_KEY: "*****"]
resValue("string", "PUSHER_APP_KEY", "*****")
resValue("string", "new_relic_key", "*****")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/*.kotlin_module'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testImplementation "io.mockk:mockk:1.9"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
implementation project(':PassengerCommon')
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.2.1'
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.firebase:firebase-config:19.1.4'
implementation 'com.google.firebase:firebase-crashlytics:17.1.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.maps.android:android-maps-utils:0.4.4'
implementation 'com.afollestad.material-dialogs:core:0.9.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.jakewharton:butterknife:10.0.0'
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.5.0")
implementation 'com.karumi:dexter:4.2.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'q.rorbin:badgeview:1.1.3'
implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0-alpha2'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.elasticode.sdk:elasticode-android:2.1.1'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.pusher:pusher-websocket-android:0.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}"
}
apply plugin: 'com.google.gms.google-services'
If you guys need anything I will gladly provide
If the app works in debug but not in release, it's probably because Proguard minified your classes and deserialization no longer works due to different (shorter) class and property names.
Make sure you have this in your proguard:
-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.SerializationKt
-keep,includedescriptorclasses class com.yourcompany.yourpackage.**$$serializer { *; } # <-- change package name to your app's
-keepclassmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's
*** Companion;
}
-keepclasseswithmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's
kotlinx.serialization.KSerializer serializer(...);
}
If deserialization still fails, please provide an example of how you are deserializing network response(s) into data classes.

Execution failed for task ':app: lintVitalRelease' due to `Could not find multidex-instrumentation.aar`

When I try to sync my app module inside android studio it prompts error:
ERROR: Failed to resolve: multidex-instrumentation Affected Modules:
app
When I try to run gradlew assemble
Execution failed for task ':app:lintVitalRelease'.
Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
Could not find multidex-instrumentation.aar (androidx.multidex:multidex-instrumentation:2.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/multidex/multidex-instrumentation/2.0.0/multidex-instrumentation-2.0.0.aar
solutions listed in this question did not fix my issue.
And an strange thing is that nothing as multidex-instrumentation-2.0.0 does not exist and I don't know why my app looks for such dependency.
Multidex-instrumentation 2.0.0 exists in Maven Repository.
Here are my build.gradle and app.gradle:
app.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 {
google()
jcenter()
maven {
url "https://maven.google.com"
}
maven { url 'https://maven.fabric.io/public' }
}
android {
// flavorDimensions ("resrouce")
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions{
disable 'MissingTranslation'
// checkReleaseBuilds false
// abortOnError false
}
defaultConfig {
applicationId 'com.myapp.android'
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName '1.0'
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "enableCrashlytics", "true"
ext.enableCrashlytics = true
}
releaseNonObfuscated {
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
buildConfigField "boolean", "enableCrashlytics", "true"
ext.enableCrashlytics = false
}
debug {
versionNameSuffix '-DEBUG'
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "enableCrashlytics", "true"
ext.enableCrashlytics = true
}
}
dexOptions {
javaMaxHeapSize "2g"
}
sourceSets {
main {
res.srcDirs = [
'src/main/res',
'src/main/res/layout',
'src/main/res/layouts/product',
'src/myapp_eve/res'
]
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
}
ext {
//support_library_version = '28.0.0'
smooch_chat_librar_version = '5.16.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//implementation 'com.android.support:28.0.0'
// implementation 'com.android.support:support-fragment:28.0.0'
// implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
// implementation 'com.android.support:collections:28.0.0'
// implementation 'com.android.support:versionedparcelable:28.0.0'
// implementation 'com.android.support:collections:28.0.0'
// implementation 'de.greenrobot:eventbus:2.4.0'
// implementation 'org.roboguice:roboguice:3.0.1'
// compileOnly 'org.roboguice:roboblender:4.0.0'
// annotationProcessor 'org.roboguice:roboblender:4.0.0'
// implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
// compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
// compile 'com.braintreepayments.api:braintree:2.3.9'
// compile 'com.braintreepayments.api:drop-in:2.3.8'
// implementation 'com.facebook.android:facebook-android-sdk:4.23.+'
//implementation 'org.roboguice:roboblender:4.0.0'
// implementation 'com.jakewharton:butterknife:10.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha04'
implementation 'com.google.android.material:material:1.1.0-alpha05'
implementation 'com.google.android.material:material:1.1.0-alpha05'
implementation 'androidx.core:core:1.1.0-alpha05'
implementation 'androidx.annotation:annotation:1.1.0-beta01'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.github.rey5137:material:1.2.5'
implementation 'com.pnikosis:materialish-progress:1.5'
// implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.commonsware.cwac:merge:1.1.2'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.malinskiy:superrecyclerview:1.1.1'
implementation 'com.daimajia.swipelayout:library:1.2.0#aar'
implementation 'com.flipboard:bottomsheet-core:1.5.0'
implementation 'com.flipboard:bottomsheet-commons:1.5.0'
implementation 'org.apmem.tools:layouts:1.10#aar'
implementation(name: 'persiandatepicker-release', ext: 'aar')
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.8#aar') {
transitive = true;
}
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.binjar.prefsdroid:prefs-droid:1.1.0'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'com.google.inject:guice:4.2.2'
implementation "io.smooch:core:${smooch_chat_librar_version}"
implementation "io.smooch:ui:${smooch_chat_librar_version}"
}
apply plugin: 'com.google.gms.google-services'
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://s3.amazonaws.com/repo.commonsware.com' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://jitpack.io' }
}
dependencies {
//vahhab change to 3.2.0
classpath 'com.android.tools.build:gradle:3.3.1'
//classpath 'com.android.tools.build:gradle:3.2.1'
//classpath 'com.google.gms:google-services:2.0.0-alpha3'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.27.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://s3.amazonaws.com/repo.commonsware.com' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://jitpack.io' }
flatDir { dirs 'libs' }
}
}
You should enable jetifier in the gradle.properties file.
android.enableJetifier=true
delete .gradle and .idea folders then rebuild the project.

Updating to AndroidStudio 3.2, when trying to build I get an issue: Could not find the AndroidManifest.xml file, using generation folder

The full problem is:
error: Could not find the AndroidManifest.xml file, using generation folder [/Users/gopublic/bamboo-home/xml-data/build-dir/131073/REF-RD-VRANDROID/app/build/generated/source/apt/debug])
This is how my build.gradle looks like:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "io.realm:realm-gradle-plugin:3.2.0"
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
def AAVersion = '4.4.0'
dependencies {
// AndroidAnnotations
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
// Support libraries
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
// Mosby mvp
implementation 'com.hannesdorfmann.mosby3:mvp:3.0.0'
implementation 'com.hannesdorfmann.mosby3:mvp-lce:3.0.0'
implementation 'com.hannesdorfmann.mosby3:mvp-nullobject-presenter:3.0.0'
// Gson
implementation 'com.google.code.gson:gson:2.8.0'
// EventBus
implementation 'org.greenrobot:eventbus:3.0.0'
// YoYo
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.2#aar'
// Glide
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:support-v4:27.1.1'
// Android SpinKit
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
// OkHTTP
testImplementation 'com.squareup.okhttp3:mockwebserver:3.6.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
// Expandable Layout
implementation 'com.github.aakira:expandable-layout:1.6.0#aar'
// Apache Common Collections
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
//Google Analytics
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
testImplementation 'junit:junit:4.12'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.2#aar') {
transitive = true;
}
implementation('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6#aar') {
transitive = true
}
}
android {
compileSdkVersion 27
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "nl.dtt.refcom4all"
minSdkVersion 16
targetSdkVersion 27
versionCode 9
versionName "1.4.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
}
}
}
signingConfigs {
release {
keyAlias 'alias here'
keyPassword 'password here'
storeFile file('keystore/release-keystore.jks')
storePassword 'password here'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.enableCrashlytics = true
ext.betaDistributionReleaseNotesFilePath = "/Users/gopublic/bamboo-home/xml-data/build-dir/131073/REF-RD-VRANDROID/changelog.txt"
}
debug{
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
ext.enableCrashlytics=true
ext.betaDistributionReleaseNotesFilePath = "/Users/gopublic/bamboo-home/xml-data/build-dir/131073/REF-RD-VRANDROID/changelog.txt"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs/ts3_sdk_3.0.4/bin/android']
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
}
This works perfectly on my machine (running the same, latest version of AS 3.2) but on my build machine, it gets this error. Any ideas what I can do, regarding this?
Is there possible to be a difference in the way AndroidStudio settings are set, that could cause this?
I reverted to using classpath 'com.android.tools.build:gradle:3.1.4' instead of classpath 'com.android.tools.build:gradle:3.2.0' and that worked

Categories

Resources