Android Studio build works, Gradle command line fails -
i have ported app eclipse android studio, implemented needed flavors , have allow working in android studio. due number of flavors prefer build using command line gradle. when run following command build release apks
gradlew.bat assemblerelease i following error:
failure: build failed exception. * where: build file 'c:\whatever\build.gradle' line: 1 * went wrong: problem occurred evaluating project ':mycompany'. > java.lang.unsupportedclassversionerror: com/android/build/gradle/appplugin : unsupported major.minor version 52.0 * try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed i have run --stacktrace , --debug , not offer other information, other pointing error first line of build.gradle:
apply plugin: 'com.android.application' i have attempted following based on other stackoverflow responses error:
- upgraded javaversion.version_1_8
- added jack build.gradle (and slowed down, required 1.8, though deprecated?)
- increased memory heap (
org.gradle.jvmargs=-xmx4096m) , dex (javamaxheapsize "4g").
i running android studio 2.3.3
here build.gradle file. have left couple of flavors save space, , renamed of stuff protect innocent. have left in dependencies in case might problem? funkiness renaming apk , pushing different folder, working when run release build directly out of android studio. build.gradle:
apply plugin: 'com.android.application' apply plugin: 'io.fabric' buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } repositories { maven { url 'https://maven.fabric.io/public' } } android { signingconfigs { config { keyalias 'whatever' keypassword 'imnotgoingtotellyou' storefile file('c:/whereever/mycompany.keystore') storepassword 'yeps' } } compilesdkversion 25 buildtoolsversion '25.0.3' defaultconfig { jackoptions { enabled true additionalparameters('jack.incremental': 'true') } applicationid "com.mycompany.default" minsdkversion 14 targetsdkversion 23 versioncode 44 versionname "2.1.44" compileoptions { sourcecompatibility javaversion.version_1_8 targetcompatibility javaversion.version_1_8 } signingconfig signingconfigs.config } dexoptions { javamaxheapsize "4g" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' signingconfig signingconfigs.config } } productflavors.whenobjectadded { flavor -> flavor.ext.set('directorypath', '') flavor.ext.set('apkname', '') } productflavors { flavor1 { signingconfig signingconfigs.config directorypath = 'flavor1' } flavor2 { applicationid 'com.mycompany.flavor2' signingconfig signingconfigs.config directorypath = 'flavor2' } applicationvariants.all { variant -> variant.outputs.each { output -> def path = "c:/androidbuilds/mybuild.build/" + variant.productflavors[0].directorypath + "/" logger.error("path = " + path) def sep = "-" def apkname = variant.productflavors[0].apkname def flavor = variant.productflavors[0].name if (apkname != '') flavor = apkname; def version = variant.versioncode def newapkname = path + version + sep + flavor logger.error("newapkname = " + newapkname) output.outputfile = new file(newapkname + ".apk") } } } dependencies { compile project(':androidpdfview100') compile 'com.android.support:support-v13:25.3.1' compile 'com.google.code.gson:gson:2.7' compile 'joda-time:joda-time:2.5' compile 'com.google.android.gms:play-services-maps:11.0.4' compile files('libs/httpmime-4.2.5.jar') compile files('libs/itextg-5.4.4.jar') compile files('libs/js.jar') compile files('libs/logentries-android-2.1.1.jar') compile files('libs/universal-image-loader-1.8.6.jar') compile files('libs/xmlworker-5.4.4.jar') compile files('libs/zbar.jar') compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; } } update
the project structure looks this:
it generated automatically android studio when ported code eclipse:
when drill app looks this:
for facing issue in future, command line build make sure javahome set jdk v8:
javahome=c:\program files\java\jdk1.8.0_112 or ever 1.8 jdk is. beast , sucks memory way around build error. not recommend build in android studion 1.8 since seems require jack plain slow. , sadly deprecated boot.


Comments
Post a Comment