gradle dependencies .so file - android

I use gradle build android project, dependencies .so file.
compile 'com.epwk:liblocSDK4d:1.0:armeabi#so'
compile 'com.epwk:libjpush170:1.0:armeabi#so'
compile 'com.epwk:libMtaNativeCrash:1.0:armeabi#so'
compile 'com.epwk.mips:libMtaNativeCrash:1.0:mips#so'
compile 'com.epwk.x86:libMtaNativeCrash:1.0:x86#so'
compile 'com.epwk.armeabiv7a:libjpush170:1.0:v7a#so'
compile 'com.epwk.armeabiv7a:libMtaNativeCrash:1.0:v7a#so'
I could see them in the external libraries.
When I run this project it get the following error:
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jpush170: findLibrary returned null
What should I do?
Ignoring class path entry C:\Users\Administrator\.gradle\caches\modules-2\files-
2.1\com.epwk\liblocSDK4d\1.0\24c2f73ec32323d8f0eac88b58731ae3336e4c93\liblocSDK4
d-1.0-armeabi.so
Ignoring class path entry C:\Users\Administrator\.gradle\caches\modules-2\files-
2.1\com.epwk\libjpush170\1.0\4e0296ffc64d57753e974110682baedd4a127d17\libjpush17
0-1.0-armeabi.so
Ignoring class path entry C:\Users\Administrator\.gradle\caches\modules-2\files-
2.1\com.epwk\libMtaNativeCrash\1.0\beefa8d28bf7c2490443d74623c2c9595d329a86\libM
taNativeCrash-1.0-armeabi.so

Related

can't find the class de.mindpipe.android.logging.log4j.LogConfigurator even I put it into the depenency

When I run an app in emulator from android studio, I get an exception. but actually, the class can be found on the jar android.logging.log4j-1.0.3.jar; and I also put the dependency to the build.gradle.
dependencies {
compile 'com.android.support:support-v4:21.1.1'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile files('libs/android-viewbadger.jar')
compile files('libs/commons-collections-3.2.1.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang-2.3.jar')
compile files('libs/aspectjrt-1.7.3.jar')
compile files('libs/isoparser-1.0.2.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/glide-3.7.0.jar')
compile files('libs/android-query-full.0.26.8.jar')
compile 'log4j:log4j:1.2.17'
compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
}
The exception is the following.
Caused by: java.lang.ClassNotFoundException: Didn't find class "de.mindpipe.android.logging.log4j.LogConfigurator" on path: DexPathList[[zip file "/data/app/com.test.app-1/base.apk", zip file "/data/app/com.test.app-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.test.app-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/test.app-1/lib/x86, /system/fake-libs, /data/app/com.test.app-1/base.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.test.app-1/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.test.app.MyApp.initLog4j(MyApp.java:268) 
BTW, the exception didn't occur before. when I upgraded to 3.3, the issue occur (Maybe, not very sure); now I don't know how to let it work.
I did more search on it. and find all classes for dependencies can't be found. not sure if they were not added into the apk.
I also checked others link, such as,
android studio java.lang.NoClassDefFoundError:
none of them works.
I fixed it by the following solution.
Go to the folder where the file build.grade is.
Run the command gradlew clean
Rebuild the project.

DexException: Multiple dex file definition

I am getting an error in Android Studio for my application which is as follows:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Error:Execution failed for task ':app:transformClassesWithDexForInmemoryDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Dependencies included are :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile ('junit:junit:4.12')
compile ('com.android.support:appcompat-v7:23.2.1')
compile ('com.soundcloud.android:android-crop:0.9.10#aar')
compile ('com.squareup:otto:1.3.6')
compile ('com.squareup.picasso:picasso:2.5.2')
compile ('com.android.support:recyclerview-v7:+')
compile ('com.android.support:cardview-v7:+')
}
I have tried tried setting multidex to true but it still doesn't solve the problem. I have also tried excluding support-v4 in dependencies.
Please help me resolve the error.
write this on your build.gradle "compile 'com.android.support:multidex:1.0.1' in dependency
Then Open your application class and inside attachBaseContext method
write MultiDex.install(this);
Hope it would help you

android studio how to use library dependencies already added in library module

--MyProject (module)
--build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project ':MyLib'
}
--MyLib (module)
--build.gradle
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.16'
compile 'com.google.code.gson:gson:2.3.1'
}
In my library module called MyLib, I've added (for example) Gson & Volley as library.
I wish to use Gson and Volley api in the MyProject module without adding the libraries again as dependencies but I can't. And when I add Gson or Volley in the MyProject build.gradle, it causes an error:
multiple dex files define
How can I reuse dependencies that already added in the MyLib module? If this is not possible, how do I avoid this multiple dex files define error? I've tried Android Studio Gradle Error: Multiple dex files define
dexOptions {
preDexLibraries = false
}
but it didn't help.
Thanks in advance.
If you wish to use the Volley and Gson libraries in each of your modules, you will need to add both libraries as dependencies in both of your build.gradle files (MyProject and MyLib).
As for the multiple dex files define error, I would try taking a look at these potential solutions:
Android Studio build error - Multiple dex files define Landroid/support/v4/
Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;
Good luck!

Android Studio: Multiple dex files define Lcom/sun/activation/registries/LineTokenizer;

Receiving this exception whilst trying to build my project. Have searched around for an answer but most cases seem to be different to mine.
Other solutions include clearing temporary files or doing a gradle clean. This does temporarily solve the issue but it reappears again after a few builds. Another way this issue can occur is if the project contains multiple copies of a library. I have searched through my project and only have one instance of activation.jar which is in my libs directory. Most other solutions seem to involve changing the build path in Eclipse, but my problem is occurring on Android Studio 0.5.8. I am using Java 1.7.
Gradle Console
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException:
Multiple dex files define
Lcom/sun/activation/registries/LineTokenizer;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
Libraries in libs dir:
activation.jar
additionnal.jar
androidplot-core-0.5.1.jar
annotations.jar
DatawindAdsSdk-2.0.jar
jpct_ae.jar
jsr305-1.3.9.jar
libGoogleAnalyticsV2.jar
mail.jar
twitter4j-core-3.0.5.jar
Dependencies: Note - ":android-cropimage" does not have any dependencies in build.gradle
Main module:
dependencies {
//Library Projects
compile project(':android-cropimage')
compile project(':facebook')
//Android SDK Libraries
//This library requires "Google Play Services" and "Google Repository" to be downloaded via SDK Manager.
compile 'com.google.android.gms:play-services:4.4.52'
//Third Party
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+'
compile 'com.jakewharton:butterknife:4.0.1'
compile 'com.j256.ormlite:ormlite-core:4.46'
compile 'com.j256.ormlite:ormlite-android:4.46'
compile 'net.hockeyapp.android:HockeySDK:3.0.1'
compile 'org.apache.httpcomponents:httpmime:4.2.5'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.squareup.picasso:picasso:2.2.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'org.msgpack:msgpack:0.6.11'
}
Facebook module:
dependencies {
compile 'com.android.support:support-v4:19.1.0'
}
Turns out this is due to a bug with the Android Gradle plugin's incremental dex option on version 0.10.2 (https://groups.google.com/forum/#!topic/adt-dev/6KbhReCE_fo). Removing the following from my build.gradle file solved the issue:
android {
dexOptions {
incremental true
}
}
As #Marepork anwered there is a bug withing gradle that has not been fixed
If you still want to use incremental build you can always use build variants and fordebug use multidex and for release a proguard

compile gradle library project fails

My project structure looks like this:
-project
--settings.gradle
--build.gradle
--src
--libA
---src
---build.gradle
--libB
---src
---build.gradle
--libC
----build.gradle
Main build.gradle has this dependencies:
dependencies {
compile project('libA')
compile project('libB')
compile project('libC')
}
LibA LibB and LibC are library project.
The problem: LibraryC depends on LibraryA and Library B. When I compile I get errors that Library C cannot find symbols of Library A or B.
When I try to add this to build.gradle of LibC
compile project('libA')
I get an error that the path is not found. I did not find a way to specify a path if both project are on the same sub hierarchy.
libC/build.gradle needs to have:
dependencies {
compile project(":libA")
compile project(":libB")
}
":libA" is an absolute project path. The leading ":" denotes the root project.
In most cases, the root project doesn't have any source code, and doesn't declare any dependencies.

Categories

Resources