I have a java REST project that communicates with an Android Project, using DTO classes.
Initially, I had created DTO classes duplicated in both projects, but now I have a new Java/JAR project with this common DTO classes and I want to use this library in both projects (Rest and Android).
I pasted the JAR file in app/libs
folder in Android Studio.
I added this file as a Jar dependency in Android Studio.
The build.gradle file contains the jar's reference compile files('libs/my-custom-jar-1.0.0.jar')
dependencies {
compile files('libs/my-custom-jar-1.0.0.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
}
I followed the steps described here but doesn't work. The classes packaged in the JAR file are not available.
I also try to "Invalidate Cache and Restart" Android Studio
[]'s
Edit
The file build.gradle
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'
})
androidTestCompile 'com.google.code.findbugs:jsr305:3.0.2'
compile project(':com.custom.dialog')
compile project(':zxing_standalone')
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.xxxxxxxx.android:library:1.0.23@aar', { transitive = true }
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
compile 'com.android.support:design:26.0.2'
compile 'commons-io:commons-io:2.0.1'
compile 'org.apache.commons:commons-lang3:3.5'
compile files('libs/my-custom-jar-1.0.0.jar')
}