Android Studio to 3.0 - Unable to merge dex[DexArchiveMergerException] - android

I have project and I added another project as module and I have big problem with this error message:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
I tried many solutions in stackoverflow and google but i don't found an answer.
For example:
I try added to defaultConfig multiDexEnabled true.
I try to clean and rebuild.
I try to Invalidate catch/Restart and then rebuild.
My project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "adms.foxitpdf"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/FoxitRDK.jar')
compile project(path: ':uiextensions_src')
}
And my module gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions{
abortOnError false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
implementation files('src/libs/FoxitRDK.jar')
}
task clearAar(type: Delete){
delete '../FoxitRDKUIExtensions.aar'
}
task makeAar(type: Exec){
dependsOn(clearAar,build)
def fromFile = 'build/outputs/aar/'
def intoFile = '../'
if(org.gradle.internal.os.OperatingSystem.current().windows) {
commandLine "cmd",
'-/C', 'copy', file("$fromFile/uiextensions_src-release.aar").absolutePath, file("$intoFile/FoxitRDKUIExtensions.aar")
}else {
commandLine "cp",
file("$fromFile/uiextensions_src-release.aar").absolutePath, file("$intoFile/FoxitRDKUIExtensions.aar")
}
}
makeAar {}.dependsOn(clearAar,build)
task makeJavaDoc(type: Javadoc) {
List<String> mSourcePath = new ArrayList<String>();
mSourcePath.add("../../fsdk/app/src/main/java/com/foxit/sdk/");
mSourcePath.add("src/main/java/com/foxit/uiextensions/UIExtensionsManager.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/Module.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/pdfreader/impl/PDFReader.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/IMenuView.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/MoreMenuConfig.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/MoreMenuModule.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/toolbar/IBaseItem.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/toolbar/IBarsHandler.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/propertybar/IMultiLineBar.java");
source = mSourcePath;
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream() ;
properties.load( inputStream )
//读取文件
def sdkDir = properties.getProperty('sdk.dir')
ext.androidJar = sdkDir + "/extras/android/support/annotations/android-support-annotations.jar"
classpath += project.files(ext.androidJar)
destinationDir = file("../../docs/api_reference_android")
failOnError false
}
makeJavaDoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
locale = "en"
title = "Document of RDK for Android"
// fsdk overview
Map<String,List<String>> map = new HashMap<>();
List<String> fsdkOverViews= new ArrayList<>();
fsdkOverViews.add("com.foxit.sdk");
fsdkOverViews.add("com.foxit.sdk.*");
map.put("Fsdk Packages",fsdkOverViews);
// UIExtensions overview
List<String> uiExtendOverViews = new ArrayList<>();
uiExtendOverViews.add("com.foxit.uiextensions");
uiExtendOverViews.add("com.foxit.uiextensions.*");
map.put("UIExtenstions Packages",uiExtendOverViews);
groups = map;
}
}
I use with Android Studio to 3.0
Someone have idea why?

I guess you need to include this below one to your gradle as well as add dependencies and include in manifest also. If you have enabled only in gradle and does not include in manifest and dependencies then give it a shot.
multiDexEnabled true
add to your dependencies
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
gradle file
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "adms.foxitpdf"
minSdkVersion 15
targetSdkVersion 24
versionCode 9
versionName "1.0"
multiDexEnabled true //Add this
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
Depending on how you override Application add this to your manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
or we can just do like this and again include in manifest with name tag.
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Read full story here

Related

Gradle - classes of a library is not includded inside the aar

I have library that is called sensorcore and I have another library (org.eclipse.paho.android.service-1.1.1.aar) that I would like to include it's classes inside the sensorcore aar that is built.(in sensorcore/build/output/arr/).
The library structure
-libraryFolder
--sensorcore
---build.gradle
--app
---build.gradle
--libs
---build.gradle
---paho.android.service.aar
-build.gradle
-settings.gradle
sensorcore/build.gradle
apply plugin: 'com.android.library'
def LIBRARY_VERSION = "1.2.8"
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 14
targetSdkVersion 31
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId = "***"
artifactId = "***"
version = "${LIBRARY_VERSION}"
from components.release
}
}
repositories {
maven {
url "mavlink"
name "Git"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation project(":libs")
}
app/build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
releasekeystore {
keyAlias '***'
keyPassword '***'
storeFile rootProject.file('secrets/key.jks')
storePassword '***'
}
}
compileSdkVersion 31
defaultConfig {
applicationId "******"
minSdkVersion 14
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releasekeystore
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation project(":sensorcore")
}
libs/build.gradle
configurations.maybeCreate("default")
artifacts.add("default", file('org.eclipse.paho.android.service-1.1.1.aar'))
libraryFolder build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'maven-publish'
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
libraryFolder settings.gradle
include ':app', ':sensorcore', ':libs'
rootProject.name='Sensor'
when I'm trying just to build it using the gradle command "gradle clean build" it gives me an error
What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'libraryFolder\secrets\key.jks' not found for signing config 'releasekeystore'.
Is it possbile to "build" without the releasekey? maybe there is any command that can do it.
I didn't find any infomation in the gradle documentation, maybe I have missed it.
Anybody has any idea how to resolve it? thank you.

Why does adding product flavors to my libraries build.gradle file cause my local app to be unable to resolve imported dependencies from said library?

I'm developing an android application for my company. The project holds directories: our sdk (library in this case) and a sample app that imports the sdk. When I add product flavors to the sdk (library) the app breaks due to being unable to resolve the dependencies imported from the sdk.
The errors are:
error cannot find symbol class S
error cannot find symbol class SO
error package S does not exist
error method does not override or
implement a method from a supertype
Here is the top-level/project level build.gradle file
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.novoda:bintray-release:0.9'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is the SDK/Library build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName version
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultPublishConfig "nonlocationVersionRelease"
publishNonDefault true
flavorDimensions "version"
productFlavors {
nonlocation {
dimension "version"
}
location {
dimension "version"
}
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
}
configurations {
javadocDeps
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
}
publish {
userOrg = '*******'
groupId = 'com.*******.android'
artifactId = '*******'
publishVersion = '2.0.0'
desc = '******* sdk'
website = 'https://github.com/*******/*******-android-public-sdk'
}
and here is the app's build.gradle file:
apply plugin: 'com.android.application'
def computeVersionCode = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', 'HEAD', '--count'
standardOutput = stdout
}
return stdout.toString().trim().toInteger();
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.*******.demo"
minSdkVersion 15
targetSdkVersion 27
versionCode computeVersionCode()
versionName "1.0"
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debugConfig {
storeFile file("debug.jks")
storePassword "*******"
keyAlias "com.*******.android"
keyPassword "*******"
}
releaseConfig {
storeFile file("release.jks")
storePassword "*******"
keyAlias "com.*******.android"
keyPassword "*******"
}
}
buildTypes {
debug {
signingConfig signingConfigs.debugConfig
}
release {
signingConfig signingConfigs.releaseConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.google.guava:guava:23.0'
implementation 'com.squareup:seismic:1.0.2'
implementation 'net.hockeyapp.android:HockeySDK:3.7.0'
implementation 'jp.wasabeef:blurry:1.0.5'
implementation project(path: ':*******-sdk', configuration:'default')
}
I have been trying to fix this for 4 days and am still stuck. I've tried all of the typical solutions found on stackoverflow. This has been a cascade of problem after problem and this specific one came directly after updating how the sdk is loaded in the app's build.gradle file. I suspect something is wrong with this line where I import the sdk as a dependency (end of app's build.gradle):
implementation project(path: ':*******-sdk', configuration:'default')
but not including 'configuration: 'default'' causes another bug where the app cannot discern which buildVariant of the SDK to use.
How can I get my app up and running while also maintaining the product flavors found in the SDK?

:app:transformClassesWithMultidexlistForDebug task failed

com.android.build.api.transform.TransformException :
Error while generating the main dex list.
com.android.tools.r8.errors.CompilationError:
Program type already present: com.xyja.bcclalib.BuildConfig
I have try these ways:
build clean my module
clean project
delete .gradle && build && .idea && [module]build
then rebuild my project
but I can't solved it. Anyone who can help me solve this? Thx.
This is my build.gradle(app).
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.xyja.bcclalib"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories{
flatDir {
dirs 'libs'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation project(':BcClaLibirary')
implementation 'com.android.support:multidex:1.0.3'
}
And this is part of my build.gradle(BcClaLibirary).
apply plugin: 'com.android.library'
android {
...
}
dependencies {
implementation files('libs/bcprov-jdk15on-157.jar')
implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
implementation files('libs/sun.misc.BASE64Decoder.jar')
implementation (name: 'ESecurityLib-release', ext: 'aar')
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
apply from: './nexus_maven.gradle'
Try this:
//app
repositories{
flatDir {
dirs 'libs'
dirs.project(':BcClaLibirary').files('libs')
//or you can use this way
//dirs 'libs', '../BcClaLibirary/libs'
}
}

How to config top level build.gradle file of chatsecure to override other build.gradles?

I use this library and want to increase targetSdkVersion to 24 and want to make this change by adding to top level build.gradle file how can I do this?
I changed build.gradle file to this, but it gives me: cannot find AndroidManifest
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
versionCode 1411005
versionName "14.1.1-RC-5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
}
}
allprojects {
repositories {
jcenter()
}
}
Add Top-level build file where you can add configuration options common to all sub-projects/modules.
Add following in build.gradle(project root) file.
ext {
configuration = [
appName : "app_Name",
applicationId : "com.xx.xxx.app",
minSdkVersion : 14,
targetSdkVersion : 24,
compileSdkVersion: 24,
versionCode : 6,
versionName : "1.3.6",
buildToolsVersion: "23.0.3",
]
libraries = [
supportVersion: "24.2.1"
]
}
In modules
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
dependencies {
compile project(':multiselect')
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
}
For example
Root gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
configuration = [
appName : "app name",
applicationId : "com.xx.xx.app",
minSdkVersion : 14,
targetSdkVersion : 24,
compileSdkVersion: 24,
versionCode : 6,
versionName : "1.3.6",
buildToolsVersion: "23.0.3",
]
libraries = [
supportVersion: "24.2.1"
]
}
buildscript {
repositories {
jcenter() // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
task checkstyle(type: Checkstyle) {
showViolations = true
configFile file("../config/checkstyle/checkstyle.xml")
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
// empty classpath
classpath = files()
}
}
task clean(type: Delete) {
delete(rootProject.buildDir)
}
App Gradle
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
android {
compileSdkVersion appConfig.compileSdkVersion
buildToolsVersion appConfig.buildToolsVersion
defaultConfig {
applicationId appConfig.applicationId
minSdkVersion appConfig.minSdkVersion
targetSdkVersion appConfig.targetSdkVersion
versionCode appConfig.versionCode
versionName appConfig.versionName
signingConfig signingConfigs.config
}
buildTypes {
release {
}
debug {
}
}
productFlavors {
}
}
dependencies {
compile project(':multiselect')
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
compile "com.android.support:cardview-v7:${libs.supportVersion}"
compile "com.android.support:recyclerview-v7:${libs.supportVersion}"
compile "com.android.support:design:${libs.supportVersion}"
}
Module Gradle
apply plugin: 'com.android.library'
def appConfig = rootProject.ext.configuration;
def libs = rootProject.ext.libraries;
android {
compileSdkVersion appConfig.compileSdkVersion
buildToolsVersion appConfig.buildToolsVersion
defaultConfig {
minSdkVersion appConfig.minSdkVersion
targetSdkVersion appConfig.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
compile "com.android.support:design:${libs.supportVersion}"
}
For more about Configure Your Build
You can also try this.
TOP level build gradle
ext {
androidCompileSdkVersion = 25
androidBuildToolsVersion = '25.0.1'
androidMinSdkVersion = 14
androidTargetSdkVersion = 25 }
ext {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
supportLibraryVersion = '25.0.1'
retrofitVersion = '2.3.0'
okhttpVersion = '3.6.0'
parcelerApiVersion = '1.1.9'
daggerVersion = '2.5'
butterknifeVersion = '8.7.0'
dependencies = [
appCompat : "com.android.support:appcompat-v7:$supportLibraryVersion",
recyclerView : "com.android.support:recyclerview-v7:$supportLibraryVersion",
cardView : "com.android.support:cardview-v7:$supportLibraryVersion",
designSupport: "com.android.support:design:$supportLibraryVersion",
support : "com.android.support:support-v4:$supportLibraryVersion",
retrofit :
"com.squareup.retrofit2:retrofit:$retrofitVersion",
retrofitConverterGson: "com.squareup.retrofit2:converter-gson:$retrofitVersion",
retrofitAdapterRxJava: "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion",
retrofitLogging : "com.squareup.okhttp3:logging-interceptor:$okhttpVersion",
rxAndroid : 'io.reactivex.rxjava2:rxandroid:2.0.1',
rxJava : 'io.reactivex.rxjava2:rxjava:2.1.0',
rxBinding : 'com.jakewharton.rxbinding:rxbinding:0.4.0',
butterknife : "com.jakewharton:butterknife:$butterknifeVersion",
butterknifecompiler : "com.jakewharton:butterknife-compiler:$butterknifeVersion",
] }
APP level build gradle
android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
buildToolsVersion rootProject.ext.androidBuildToolsVersion
defaultConfig {
applicationId "com.developerandroid"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
Map<String, String> dependencies = rootProject.ext.dependencies
//support
compile dependencies.appCompat
compile dependencies.recyclerView
compile dependencies.cardView
compile dependencies.designSupport
compile dependencies.support
// retrofit
compile dependencies.retrofit
compile dependencies.retrofitConverterGson
compile dependencies.retrofitLogging
compile dependencies.retrofitAdapterRxJava
// rx
compile dependencies.rxJava
compile dependencies.rxAndroid
compile dependencies.rxBinding
}

Crashylitcs integration with android lib

I'm debugging stuff on a lib and was trying to integrate crashlytics on it. At first, I've followed this, and after some problems, managed to build the library without errors.
The thing is: when I try to use Fabric.with(this, new Crashlytics(), new CrashlyticsNdk()) in the app which uses that lib, it gives me an "symbol cannot be resolved".
I've tried moving this line into the lib, but all I've got was a NoClassDefFoundError.
Any suggestions?
Below, my lib gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
minSdkVersion 9
targetSdkVersion 9
versionCode 1
versionName "1.0"
}
buildTypes {
release {
}
}
productFlavors {
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/mylib.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.0#aar') {
transitive = true
}
}
and my app gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
applicationId 'com.test.app'
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName '1.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'LICENSE.txt'
}
sourceSets {
androidTest.setRoot('src/test')
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
productFlavors {
}
splits {
abi {
enable true
reset()
include 'armeabi'
}
}
}
repositories {
flatDir { dirs 'libs' }
}
dependencies {
compile(name: 'my-framework', ext: 'aar')
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
}

Categories

Resources