How to make jar file including extended libraries in android studio - android

I would like to create a exported jar file in Android studio,
but the problem here, the dependencies of gson , rxjava and retrofit did not include from the jar file, when i imported to other project
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:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
// API CONNECTION
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.3.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'junit:junit:4.12'
}
task deleteJar(type: Delete) {
delete 'libs/logmanagementlib.jar'
}
task createJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('libs/jars/')
include('classes.jar')
rename('classes.jar', 'logmanagementlib.jar')
}
createJar.dependsOn(deleteJar, build)
can you give me a example how to include the compile 'com.google.code.gson:gson:2.6.1?

Related

Why my app is not compatible with old OS versions like 4.4 etc?

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.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:9.4.0'
testCompile 'junit:junit:4.12'
}
in above code, i have given my apps dependencies. i want to know whether dependencies

What are firebase dependencies for appcompact-v7:25.3.1

I keep getting errors when I try to sync my gradle. It has something to do with the SDK version. I would like to know which firebase dependcies fit to 25.3.1
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:25.3.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
//compile 'com.firebase:firebase-jobdispatcher:1.0.2'
//compile 'com.firebaseui:firebase-ui:0.5.2'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You should use 10.2.1 and 1.2.0 version .
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
Clean-Rebuild and Run .
// Getting a "Could not find" error? Make sure you have
// the
latest Google Repository in the Android SDK manager

Chat + Map = NoSuchMethodError: com.google.firebase.FirebaseApp.zzUV

I set up chat on firebase and it worked. But when i'm adding the map, chat stopped work.
When i'm trying open chat in the app i get the error
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoSuchMethodError: com.google.firebase.FirebaseApp.zzUV
my dependencies:
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 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
allprojects {
repositories {
// ...
maven { url 'https://maven.fabric.io/public' }
}
}
Add this in your build.gradle file and Rebuild project.
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'

java.util.zip.ZipException with retrofit 2

I'm having
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: retrofit2/BuiltInConverters$BufferingResponseBodyConverter.class
I can't understand from where this error come and why
Appaered whe i added gson converter from retrofit2
I already clean the project
my 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'
})
//compile files('libs/gson-2.7.jar')
// compile files('libs/okhttp-3.4.1.jar')
//compile files('libs/okio-1.11.0.jar')
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.2.1'
testCompile 'junit:junit:4.12'
}
//compile files('libs/gson-2.7.jar')
// compile files('libs/okhttp-3.4.1.jar')
//compile files('libs/okio-1.11.0.jar')
You commented these, but those are still being compiled
compile fileTree(dir: 'libs', include: ['*.jar'])
You need to actually remove the jar files if you do not want to compile them. In other words, make sure you don't have any retrofit related jar files in the libs folder
Remove the jar file retrofit2 in libs

How to avoid android.support.v4.app.ActivityCompatHoneycomb has already been added

Hil all,
this my error :
Error:Class android.support.v4.app.ActivityCompatHoneycomb has already
been added to output. Please remove duplicate copies.
and my dependecies are :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:support-v4:22.0.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.google.android.gms:play-services:7.0.0')
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/ormlite-android-4.45.jar')
compile files('libs/ormlite-core-4.45.jar')
compile files('libs/jackson-databind-2.1.4.jar')
compile files('libs/jackson-core-2.1.4.jar')
compile files('libs/jackson-annotations-2.1.4.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/paralloidviews.jar')
compile files('libs/jsr250-api-1.0.jar')
compile project(':volley')
compile project(':Android-RSS-Reader-Library-master')
compile project(':facebook')
compile project(':Forecast')
compile project(':headerListView')
compile project(':library-sliding-menu')
compile files('libs/panoramagl.jar')
compile project(':paymentKit_lib')
compile project(':ProgressWheel-master')
compile project(':UIL_library')
compile files('libs/coverflowlibrary.jar')
}
so where I could find the duplacte copies, can you help me please, I struggle with this error a long time ago !
This is most probably happening because one of your library projects already contains support-v4. Try to remove compile('com.android.support:support-v4:22.0.0') from your dependencies and check. This should solve the problem

Categories

Resources