I\'m developing an app in which I\'m using this library.
On compiling the project, this error containing TransformException
and RuntimeException<
I think you missed to add MultiDexApplication
in your manifest
.
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
If you missed it. Add it and clean and rebuild project.
If you use Application Class, your application class should extend MultiDexApplication
not Application.
class MyApplication extends MultiDexApplication
Reference: https://developer.android.com/studio/build/multidex.html
Hope it helps :)
Put this code in your first activity(starting activity of the app):
public class YouApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
You are getting
DuplicateFileException: Duplicate files copied in APK
Make sure Same dependencies are calling or not .
Pull exclude out of the dependencies section and put in configurations. e.g.
dependencies {
...
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
...
}
configurations {
all*.exclude group: 'org.apache.httpcomponents',module: 'httpclient'
}
From the log:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK log4j.properties
File1: C:\Users\user\.gradle\caches\modules-2\files-2.1\org.brunocvcunha.inutils4j\inutils4j\0.4\566b82b1e70d7ebb8d1d3bb513d4bbf7913b118b\inutils4j-0.4.jar
File2: C:\Users\user\.gradle\caches\modules-2\files-2.1\org.brunocvcunha.ghostme4j\ghostme4j\0.2\d44c3633f23975c355c89192d6e8daa9ce549b2d\ghostme4j-0.2.jar
It looks like you need to exclude log4j.properties from your project because it reside in both of the libraries (inutils4j and ghostme4j). You can try using:
android {
...
packagingOptions {
exclude '**/log4j.properties'
}
...
}
Read more about PackagingOptions.