The Problem is that , I'm getting error while generating Signed APK using Allatori Java
Obfuscator
. I tried different hacks like, Invalidate and Clear cache /Restart
,by deleting build folder, rebuilding project, Strings
, Even tried comparing package names ,Class Naming conventions, possible jars
, deprecated
methods
or classes
but Its of no use.! Multi Dex
is enabled as well.! and I tried every possible Solution but unable to generate signed APK
.
apply plugin: 'com.android.application'
apply plugin: 'ensighten'
ext {
supportVersion = "25.3.1"
googleServices = "11.4.2"
}
android {
def version = "2.0.0"
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "removed"
minSdkVersion 15
targetSdkVersion 25
versionCode 20
versionName "${version}"
multiDexEnabled true
def today = new Date().format('yyyyMMdd_HHmmss').toString()
project.ext.set("archivesBaseName", "MyApplication_Android_Build_"+ today + "_Version " + version);
}
applicationVariants.all { variant ->
variant.javaCompile.doLast {
runAllatori(variant)
}
}
buildTypes {
debug {
buildConfigField "boolean", "LOG_ENABLED", "true"
buildConfigField "boolean", "SSL_ENABLED", "true"
buildConfigField "String", "SERVER_URL", "\"http:///\""
}
release {
buildConfigField "String", "SERVER_URL", "\"http://\""
buildConfigField "boolean", "LOG_ENABLED", "false"
buildConfigField "boolean", "SSL_ENABLED", "true"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
android {
aaptOptions {
cruncherEnabled = false
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://ensighten-mobile.bintray.com/maven" }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.1'
classpath "com.ensighten.plugin.android:ensighten:2.0.1"
}
}
apply plugin: 'io.fabric'
repositories {
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/vividadmin/maven" }
maven { url "https://ensighten-mobile.bintray.com/maven" }
mavenCentral()
google()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':williamchart')
compile "com.android.support:appcompat-v7:${project.ext.supportVersion}"
compile "com.android.support:design:${project.ext.supportVersion}"
compile "com.android.support:percent:${project.ext.supportVersion}"
compile "com.android.support:cardview-v7:${project.ext.supportVersion}"
compile "com.android.support:recyclerview-v7:${project.ext.supportVersion}"
compile "com.android.support:animated-vector-drawable:${project.ext.supportVersion}"
compile "com.android.support:gridlayout-v7:${project.ext.supportVersion}"
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile "com.google.firebase:firebase-crash:${project.ext.googleServices}"
compile "com.google.firebase:firebase-core:${project.ext.googleServices}"
compile "com.google.firebase:firebase-invites:${project.ext.googleServices}"
compile "com.google.firebase:firebase-messaging:${project.ext.googleServices}"
compile "com.google.android.gms:play-services-analytics:${project.ext.googleServices}"
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'net.danlew:android.joda:2.9.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.scottyab:aescrypt:0.0.1'
compile 'net.cachapa.expandablelayout:expandablelayout:2.9.1'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile 'com.ensighten.android:ensighten-core:2.4.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.gson:gson:2.8.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
def runAllatori(variant) {
copy {
from "$projectDir/allatori.xml"
into "$buildDir/intermediates/classes/"
expand(classesRoot: variant.javaCompile.destinationDir,
androidJar: "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar",
classpathJars: variant.javaCompile.classpath.getAsPath(),
logFile: "allatori-log-${variant.name}.xml")
rename('allatori.xml', "allatori-${variant.name}.xml")
}
new File("${variant.javaCompile.destinationDir}-obfuscated").deleteDir()
javaexec {
main = 'com.allatori.Obfuscate'
classpath = files("$rootDir/allatori/allatori.jar")
args "$buildDir/intermediates/classes/allatori-${variant.name}.xml"
}
new File("${variant.javaCompile.destinationDir}").deleteDir()
new File("${variant.javaCompile.destinationDir}-obfuscated").renameTo(new File("${variant.javaCompile.destinationDir}"))
}
Error:
Error:Error converting bytecode to dex: Cause: PARSE ERROR: class name (com/pckg/pakistan/myapplication/R) does not match path (com/pckg/pakistan/myapplication/r.class) ...while parsing com/pckg/pakistan/myapplication/r.class
Error:Execution failed for task ':app:transformClassesWithDexForRelease'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
As per my knowledge you are using lot of libraries and using Allatori Java Obfuscator due to Allatori obfuscation your java code is not being properly converted into byte code and thats the reason you are unable to generate signed apk. Try a quick hack delete build files ,gradle files and invalidate and restart your project more than once
Hope this may help u :)
There is no Signing config in Gradle you have added, So first Create a Keystore ( https://developer.android.com/studio/publish/app-signing.html )
and then add in the app level Gradle
signingConfigs {
release {
// For making app store release config below parameters
storeFile file('path to keystore')
storePassword "keystore password"
keyAlias "Alias_of_keystore"
keyPassword "Keystore Password"
}
}
after that in build types add
buildTypes {
// For app store release uncomment below and select release build flavor in Build Variants
release {
...
signingConfig signingConfigs.release
}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.