I am developing Android library. When My Client(Application developer) applied my Jar file, it is shown error message.
Build is normal working, But When I run(playButton) App in Android Studio, it is occurred.
The error message shown like below :
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't read [/Users/VSSCP_KYOSEON/Documents/Work/Android/A/B/app/build/intermediates/transforms/jarMerging/debug/jars/1/1f/combined.jar] (Can't process class [com/a/b/VSFunctionActivity.class] (Unknown verification type [88] in stack map frame))
This is my Application Gradle Code :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.a.b"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile project(':ChartLib')
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/vs_sat_sdk.jar')
}
My Jar file is vs_sat_sdk.jar. It is applied to proguard.
I already applied Android Multidex guide. https://developer.android.com/tools/building/multidex.html But I failed to execute.
I have normal operation situation.
1. I apply proguard in My jar file. and When minSdkVersion is over 21, it is normal operation. But When minSdkVersion is under 21, it is shown failed.
2. If My jar file doesn't applied proguard, regardless of minSdkVersion, it is normal operation.
please let me know about your solution.
Regards.
Maybe the jar file has been processed by a tool that does not correctly update the StackMapFrame attribute.
Actually, StackMapFrame attributes are not needed for Android development, so you could instruct ProGuard to not create it and it might solve your issue. Add the following to your configuration when applying ProGuard to your library:
-dontpreverify
Related
I've been struggling with getting RenderScript to work on my app with a TargetSDKVersion 26 and a minSDKVersion 21 getting an error at Gradle Sync:
Error:Execution failed for task ':app:compileDebugRenderscript'.
com.android.ide.common.process.ProcessException: Error while executing process /home/mail929/.android/sdk/build-tools/26.0.2/llvm-rs-cc with arguments {-O 3 -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/include/ -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/clang-include/ -p /home/mail929/Code/Android/SmartME/app/build/generated/source/rs/debug -o /home/mail929/Code/Android/SmartME/app/build/generated/res/rs/debug/raw -target-api 21 /home/mail929/Code/Android/SmartME/app/src/main/rs/combine.rs}
Eventually I noticed at the bottom of the documentation page:
Graphics Functions and Types
The graphics subsystem of RenderScript was removed at API level 23.
Does this mean I can't use RenderScript at all? If so are there any good alternatives?
Here is my complete build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "edu.marquette.mcw.smartme"
minSdkVersion 21
targetSdkVersion 26
versionCode 4
versionName "2rc1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 18
renderscriptSupportModeEnabled false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:cardview-v7:26.0.0'
testCompile 'junit:junit:4.12'
}
No, Renderscript hasn't been completely deprecated, only the graphics functionality which operated on some OpenGL type constructs directly. Since it was more or less doing the same thing available in OpenGL, it was dropped and instead you can exchange textures with OpenGL.
The combination of minSdkVersion and renderscriptTargetApi in your build.gradle will result in the minSdkVersion being used for the Renderscript target API. The way this works can get really odd. Unless you absolutely need something in the android.renderscript framework package, use the support library version by setting renderscriptSupportModeEnabled to true. This may also help resolve whatever issue you are seeing. If it doesn't, try to provide more details from the build log.
Well I actually decided to manually run the command to see what was wrong and recevied the following error:
error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
I fixed this by installing ncurses-compat-libs on Fedora and Gradle Sync completes successfully
I created my first Android app 2 years ago in Eclipse and now I have some time to improve it. I do not have Eclipse installed anymore, so I decided to import the project into Android Studio.
But now I am running into several problems:
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:10.2.0]
So in the build.gradle I changed it to 14. Then I got the next error
Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
So therefor I changed the compileSdkVersion and the targetSdkVersion to 25 (correct me if it's wrong). And I changed
compile 'com.android.support:support-v4:20.0.0'
into
compile 'com.android.support:support-v4:25.2.0'
Now I could build my project. But when I tried to run my app, after more then 5 minutes(!) I got the next error :
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
So then I added
multiDexEnabled true
and
compile 'com.android.support:multidex:1.0.1'
and
android:name="android.support.multidex.MultiDexApplication"
to the manifest file.
My build.gradle now looks like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "<<myApplicationId>>"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:25.2.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/AppFireworks.jar')
compile files('libs/fcvtgzwtzuliivdcu.jar')
compile 'com.android.support:multidex:1.0.1'
}
But now I got the following pop-up and errors
Instant Run does not support deploying build variants with multidex enabled, to a target with API level 20 or below. To use Instant Run with a multidex enabled build variant, deploy to a target with API level 21 or higher.
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
What have I done wrong? Do I have to change the minSdkVersion to 21? I want to be able to run my app on Android 4.x. I could when I was developing in Eclipse. So far switching from Eclipse to Andriod Studio is going from bad to worse. :-(
you are compiling using compile 'com.google.android.gms:play-services:+'
play service is itself is a large library. You should not use + which implies all available version to compile
Rather use a specific version of play services or break down the library and use specific services like location,maps etc.
Also u can use dexOptions to increase ur memory usage during compilation
try changing your gradle file to:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "<<myApplicationId>>"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:25.2.0'
compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.google.android.gms:play-services-plus:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'com.google.android.gms:play-services-games:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1'
compile files('libs/AppFireworks.jar')
compile files('libs/fcvtgzwtzuliivdcu.jar')
compile 'com.android.support:multidex:1.0.1'
}
I am trying to build an app which is composed out of separate library projects.
To do this, I'm trying to make a proof of concept which is supposed to be as following:
I tried to keep the project as simple as possible. The projects contents do not matter!
All that matters is the dependencies between the projects!
The result should be that MainProject will print out Something Another String!
I have tried all from .JAR files to .AAR files, but the best I got was
with the dependency in red. I added the StringExtender.aar file to StringReturner, and then the StringReturner.aar file to the MainProject.
When I do this I get the following Exception:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/example/erik/stringextender/StringExtender;
What is the right way to setup a simple proof of concept like this? I can't seem to find anything related to a library project having a dependency. It's all 1 level deep!
Any help is welcome!
EDIT SHOWING GRADLE BUILD FILES
StringReturner:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile project(':StringExtender-lib-debug')
}
MainProject:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.erik.erikpoc10"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile project(':StringReturnerLib-debug')
}
Use the following tutorial - Creating libraries for Android applications
See a working example project on my Github
The most important steps taken were:
8.3. Create library module.
8.6. Define dependency to the library project.
Do not forget to import the library class you want to use, for example:
In MainProject: import com.example.stringreturner.StringReturner.
In StringReturner: import com.example.stringreturner.StringExtender.
The info below is based on the image you provided:
The library methods are not static so don't forget to make an actual object.
So StringReturner should make a StringExtender object, And MainProject should make a StringReturner object first!
And finally, I think it's a typo but both libraries have the class StringReturner. This will not work in the StringReturner library for obvious reasons.
I should also note that I used Android Studio 2.0 and I did not touch .JAR files nor .AAR files. I merely created two library modules and one app. Then configured the Project Structure -> Dependencies by adding Module Dependencies.
Actually the main error is "java.exe finished with non-zero exit value 1". First i tell you every problem which i faced after installing studio:
Three days ago, i just installed android studio & I created new project.
1) First it throw the error "Plugin is too old, please update to more recent version", after searching on google i changed
classpath : com.android.tools.build:gradle:2.0.0-alpha2
to
classpath : com.android.tools.build:gradle:2.0.0-alpha8
Current Error solved.
2) After that it was asking for gradle 2.10, i updated this one also & set the path.
Current Error solved.
3) When i ran my application i got one more error "app-debug-unaligned.apk, specified for property 'input file' does not exist".
I searched on internet, i got one solution on stackoverflow. So as answer on stackoverflow i go to "Build" & i selected build apk.
Current error solved.
4) But after that again i got one error
"To run dex in process, the Gradle daemon needs a larger heap. It currently has 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 1G.
java.exe finished with non-zero exit value 1".
I have been searching on stackoverflow for last three days, i applied each and every answer one by one but i'm not able to solve the error. Please save my life, i am really tired of this problem. I show you image what error is coming exactly
My build.gradle file
apply `plugin: com.android.application`
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "java.danish.org.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
I updated everything SDK platforms & SDk Tools.
Please tell me what i am doing wrong here.
Issue
In gradle plugin version 2.0.0-alpha7 and -alpha8 Dex runs inside gradle build process as opposed to a separate process.
Option a)
Change gradle plugin version to 2.0.0-alpha9 where in-process Dex is disabled by default.
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
Option b)
Disable in-process dex in your app module build.gradle:
android {
// ...
dexOptions {
dexInProcess = false
}
}
Option c)
Increase memory available to gradle process.
Create or update gradle.properties file in your project root directory:
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m
And update your app module build.gradle file:
dexOptions {
preDexLibraries true
javaMaxHeapSize "3g"
incremental true
dexInProcess = true
}
These values are experimental and work for my setup. I use 3 GB for dex and 4 GB for gradle (3 + 1 GB).
Note
If you have any issues update to alpha9 anyway.
I found the solution.
Changes
1)
dexOptions {
javaMaxHeapSize "4g"
}
2)
lintOptions {
checkReleaseBuilds false
abortOnError false
}
This is my new build.gradle and everything is working fine now.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc4"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.aquasoft.guesp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:design:23.4.0'
compile 'com.stripe:stripe-android:+'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support:cardview-v7:23.3.+'
}
try this gradle params
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
I am struggling to run a basic Mapsforge application. I have added all its required jar files to project and gradle. But i am not able to run application. Getting following error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: org/mapsforge/map/reader/Way.class
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "test.mapsforge"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile files('libs/mapsforge-core-0.5.1.jar')
compile files('libs/mapsforge-map-0.5.1.jar')
compile files('libs/mapsforge-map-android-0.5.1.jar')
compile files('libs/mapsforge-map-awt-0.5.1.jar')
compile files('libs/SwingMapViewer-0.5.1.jar')
}
Folder structure
I have tried adding multiDexEnabled true in gradle config but didnt worked
Is there a reason you need to multidex? The decencies seem somewhat scarce and unless they are packed with methods I don't see how you would get past the 65k method limit. I also don't see a dependency for compile 'com.android.support:multidex:1.0.0' Please check https://developer.android.com/tools/building/multidex.html or try not using ultidex. You also may need to extend MultiDexApplication instead of a regular Application. I think your issue is really a duplicate dependency and not aa dex limit. have you tried gradle :app:dependencies?
I face same error too. when I delete swing map viewer every thing work fine even without using multiDexEnabled true