How to include .aar dependency into Android library .aar file - android

I write some library, which has a portion of UI. Also, this library uses another libraries.
I want to provide release .aar to use this portion of UI in any App.
My library has next dependecies:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
When I built .aar everything is fine, but when I inlude this .aar into another app, I have next problems:
1). ./gradlew clean build
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
:app:processDebugResources FAILED
Solution is very simple - add to MainApp/app/build.gradle next line:
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
2). When I run MainApp getting this error:
java.lang.NoClassDefFoundError: com.my.sdk.ui.fragment.DialogAppNotInstalledFragment
To solve this I need to add compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0' to MainApp/app/build.gradle.
Same to other dependecies.
In the result I need just copy-paste all my dependecies from my library project to MainApp project.
Is it possible to make library aar contain all necessery dependecies?
build.gradle of library:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
// Task androidSourcesJar is provided by gradle-mvn-push.gradle
//artifact androidSourcesJar {
// classifier "sources"
//}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://my-nexus-url/"
}
}
}
MainApp/app/build.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'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://my-nexus-url/' }
flatDir {
dirs 'libs'
}
}
android {
signingConfigs {
some_config {
keyAlias 'some alias'
keyPassword '741789654uppy'
storeFile file('../my-keystore.jks')
storePassword 'some_password'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.company.app.android"
minSdkVersion 14
targetSdkVersion 23
versionCode 9
versionName "1.0.0"
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.some_config
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/StartAppInApp-2.3.1.jar')
// compile files('libs/android-support-v4.jar')
compile files('libs/applovin-sdk-5.2.0.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
//here is my library!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
compile('com.my.sdk:SDK:0.0.1#aar'){
transitive = true;
exclude(group:'android.support', module: 'support-v4')
}
//***********************************************
//Dependecies from library
//***********************************************
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.android.support:appcompat-v7:23.1.1'
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//************************************************
}
UPDATE
Generated POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.sdk</groupId>
<artifactId>SDK</artifactId>
<version>0.0.1</version>
<packaging>aar</packaging>
</project>

If anybody have the same problem, you may obtain correct answer here
Result build.gradle is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
pom.withXml {
def depsNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each { dep ->
if(dep.name != null && dep.group != null && dep.version != null) {
def depNode = depsNode.appendNode('dependency')
depNode.appendNode('groupId', dep.group)
depNode.appendNode('artifactId', dep.name)
depNode.appendNode('version', dep.version)
//optional add scope
//optional add transitive exclusions
}
}
}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://nexus-repository-url/"
}
}
}

Related

Andriod Build failing due to com.android.support:support-vector-drawable:26.0.2 depends on one or more Android Libraries

In my CI pipeline until June 6 it worked. Today it failed. The following build error occurred.
WARNING: Module 'com.android.support:support-vector-drawable:26.0.2' depends on one or more Android Libraries but is a jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not find support-vector-drawable.jar (com.android.support:support-
vector-drawable:26.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-vector-
drawable/26.0.2/support-vector-drawable-26.0.2.jar
Build.Gradle file
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "io.realm:realm-gradle-plugin:3.1.4"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:5.+'
classpath 'com.google.gms:google-services:3.1.0'
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://mobile-sdk.jumio.com' }
maven {
url "https://maven.google.com/" // Google's Maven repository
}
maven {
url "http://kochava.bintray.com/maven"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'newrelic'
apply plugin: "io.spring.dependency-management"
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
defaultConfig {
applicationId "com.seven.eleven.phoenix"
minSdkVersion 19
targetSdkVersion 26
versionCode 16
versionName "1.1.1_1_QA"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 21
renderscriptSupportModeEnabled true
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
sourceSets { main { assets.srcDirs = ['src/main/assets',
'src/main/assets/fonts'] } }
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
buildTypes.each {
it.buildConfigField 'String', 'STRIPE_APIKEY',
keystoreProperties['StripeKey']
it.buildConfigField 'String', 'PHOENIX_API_KEY',
keystoreProperties['PhoenixAPIKey']
it.buildConfigField 'String', 'NEW_RELIC_KEY',
keystoreProperties['NewRelicKey']
it.buildConfigField 'String', 'OPEN_WEATHER_API_KEY',
keystoreProperties['OpenWeatherAPIKey']
it.buildConfigField 'int', 'WORKING_BRANCH', getCurrentGitBranch()
}
}
def getCurrentGitBranch() {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
}
if(gitBranch.contains('master')||gitBranch.contains('PROD') ||
gitBranch.contains('7XXX_Master')){
return "1";
} else {
return "0";
}
}
ext {
SDK_VERSION = "2.10.0"
ANDROID_VERSION = "26.0.2"
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.squareup.retrofit2:retrofit:2.3.0')
{
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compile('com.squareup.retrofit2:converter-gson:2.3.0')
{
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compile group: 'de.mindpipe.android', name: 'android-logging-log4j',
version: '1.0.3'
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile "com.android.support:cardview-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:mediarouter-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:palette-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:design:${ANDROID_VERSION}#aar"
compile "com.android.support:appcompat-v7:${ANDROID_VERSION}#aar"
compile "com.jumio.android:core:${SDK_VERSION}#aar"
compile "com.jumio.android:bam:${SDK_VERSION}#aar"
compile "com.jumio.android:nv:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-mrz:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-barcode:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-barcode-vision:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-liveness:${SDK_VERSION}#aar"
compile "com.jumio.android:dv:${SDK_VERSION}#aar"
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber',
version: '7.0'
compile('com.squareup.retrofit2:converter-simplexml:2.3.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
compile('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
exclude group: 'xpp3', module: 'xpp3'
}
compile files('libs/simple-xml-2.7.1.jar')
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.kochava.base:tracker:3.2.0'
compile 'com.newrelic.agent.android:android-agent:5.+'
compile 'com.stripe:stripe-android:6.0.0'
testCompile 'junit:junit:4.12'
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
provided 'javax.annotation:jsr250-api:1.0'
//for pay with google using google wallet service
compile 'com.google.android.gms:play-services-wallet:11.6.0'
compile 'com.google.android.gms:play-services:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'org.jsoup:jsoup:1.11.2'
compile
compile('com.amazonaws:aws-android-sdk-kms:2.6+') { transitive = true; }
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile "org.robolectric:robolectric:3.6.1"
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.257'
}
}
apply plugin: 'com.google.gms.google-services'
I have included the build gradle file as well as app level project configuration It was unable to download that dependency.Any help would be greatly appreciated.we are using an gradle 4.1 and a docker container to make the build. I used command ./gradle clean initially.

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. with release

When i generate release build then i got this error
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/arch/core/internal/SafeIterableMap$ListIterator.class
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.hatchapps.multimedia"
minSdkVersion 16
targetSdkVersion 26
versionCode 17
multiDexEnabled = true
versionName "1.0"
// aaptOptions.cruncherEnabled = false
// aaptOptions.useNewCruncher = false
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// minifyEnabled false
multiDexEnabled = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
packagingOptions {
exclude '.readme'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'AndroidManifest.xml'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'eu.inloop:localmessagemanager:0.1.5'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.koushikdutta.ion:ion:2.2.1'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.cocosw:bottomsheet:1.3.0#aar'
compile 'com.zhy:flowlayout-lib:1.0.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.3.0'
compile 'com.andkulikov:transitionseverywhere:1.7.4'
compile 'com.master.android:permissionhelper:1.1'
compile 'net.alhazmy13.MediaPicker:libary:2.3.2'
compile 'com.github.jaychang0917:SimpleText:1.2.1'
compile 'com.github.tabassumLatif:ShimmerRecyclerView:0.1.2'
compile 'com.tomergoldst.android:tooltips:1.0.6'
compile 'com.github.Pixplicity:sharp:03c1568d26'
compile 'id.zelory:compressor:2.0.0'
compile 'com.github.danikula:AndroidVideoCache:v2.7.0'
compile ('com.google.firebase:firebase-messaging:11.0.2'){
force = true
}
compile 'com.fenchtose:tooltip:0.1.5'
compile 'com.jsibbold:zoomage:1.1.0'
compile 'at.blogc:expandabletextview:1.0.3'
compile 'com.github.douglasjunior:android-simple-tooltip:0.2.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
compile 'com.oginotihiro:cropview:1.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.wonderkiln:camerakit:0.11.0'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile('com.android.support:support-v4:26.1.0'){
force = true
}
}
apply plugin: 'com.google.gms.google-services'
and
// 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:3.0.0'
// classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
// classpath 'com.google.firebase:firebase-plugins:1.0.5'
classpath 'com.google.gms:google-services:3.0.0'
// classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://plugins.gradle.org/m2/" }
/*maven {
url "https://maven.google.com"
}*/
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Reading the comments, and having this problem myself, the problem seems to stem from a bad thirdparty lib. Perhaps using incompatible gradle or buildtool library.
Problem libs:
com.wonderkiln:camerakit:0.11.0
android.arch.persistence.room
com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer
Others have similar problems with bad libs in their /libs folder.

com.android.ide.common.process.ProcessExaception: org.gradle.process.internal.ExecException: finished with non-zero exit value 2

i getting this exception whenever i tried to run the project as method count overflow but when i build signed apk it runs fine ..furthermore i enabled proguard for realse so it is proguard which prevents multidex.. i get confused about multidex whether it is good or bad & why it is not showing any error while genrating signed apk .. any help is appriciated..below is my build.gradle file
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'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
repositories {
maven { url "https://jitpack.io" }
}
android {
signingConfigs {
}
compileSdkVersion 23
useLibrary 'org.apache.http.legacy'
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.xxx.xxxx"
minSdkVersion 15
targetSdkVersion 22
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile(project(':facebook')) {
exclude group: 'com.android.support', module: 'multidex'
}
compile project(':Volley')
compile project(':squarecamera')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
//compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
compile 'info.hoang8f:android-segmented:1.0.6'
compile 'com.shamanland:xdroid-toaster:0.0.10'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:design:23.1.1'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.malinskiy:superrecyclerview:1.1.2'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.2'
compile 'com.github.lecho:hellocharts-library:1.5.5#aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compil'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.0'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.klinkerapps:android-chips:1.0.1#aar'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}

heap size issue in android studio

I have the following issue when run my application using android studio
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 5120 MB.
To do this set org.gradle.jvmargs=-Xmx5120M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:_4SaleApp:validateDebugSigning
:_4SaleApp:packageDebug
:_4SaleApp:zipalignDebug
:_4SaleApp:fullDebugBuildInfoGenerator
:_4SaleApp:assembleDebug
can any one tell me how to solve this problem ?
EDIT
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.mutualmobile.gradle.plugins:dexinfo:0.1.2'
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.forsale.forsale"
minSdkVersion 15
targetSdkVersion 15
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'lib/armeabi-v7a/libblasV8.so'
}
dexOptions {
incremental true
javaMaxHeapSize "10g"
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['libs']
}
}
productFlavors {
}
/*lintOptions {
checkReleaseBuilds false
abortOnError false
}*/
}
repositories {
jcenter()
maven {
url 'https://zendesk.artifactoryonline.com/zendesk/repo/'
}
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
maven {
url "https://jitpack.io"
}
maven {
url "http://appboy.github.io/appboy-android-sdk/sdk"
}
maven {
url 'https://zendesk.artifactoryonline.com/zendesk/repo'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':gestureimageview')
compile project(':ffmpeg4android_lib')
compile 'com.android.support:multidex:1.0.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/android-hipmob-2.9.8.jar')
compile files('libs/HockeySDK-3.5.0.jar')
compile files('libs/httpclient-4.3.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/libphonenumber-5.2v1.5.jar')
compile files('libs/NineOldAndroid-2.4.0.jar')
compile files('libs/org.apache.commons.io.jar')
compile files('libs/zbar.jar')
compile files('libs/quickblox-android-sdk-core-2.5.jar')
compile files('libs/quickblox-android-sdk-chat-2.5.jar')
compile files('libs/quickblox-android-sdk-content-2.5.jar')
compile files('libs/quickblox-android-sdk-messages-2.5.jar')
compile files('libs/renderscript-v8.jar')
compile('com.appboy:android-sdk-ui:1.11.2') {
exclude group: 'com.android.support', module: 'multidex'
}
compile group: 'com.zendesk', name: 'sdk', version: '1.6.0.1'
compile 'com.zopim.android:sdk:1.1.0'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.github.jaydeepw:poly-picker:v1.0.22'
compile 'com.github.bmelnychuk:atv:1.2.+'
compile 'com.wdullaer:materialdatetimepicker:2.0.2'
compile 'com.danikula:videocache:2.3.4'
compile 'com.instabug.library:instabug:2.+'
//compile 'com.google.android.gms:play-services:8.3.0'
//compile 'com.google.android.gms:play-services-ads:8.3.0'
//compile 'com.google.android.gms:play-services-auth:8.3.0'
//compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:support-v4:23.2.1'
}
Look my ScreenShot and add this line :
On build.gradle() add
android {
...
dexOptions {
javaMaxHeapSize "3g"
}
..
}
And on gradle.properties add
org.gradle.jvmargs=-Xmx5120M

Android GreenDAO Generator Error Gradle 2.0.0

I have updated my Android Studio. Now when I run my DAOGenerator I receive this error:
Error:Gradle: A problem occurred configuring root project 'xxxxxx'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.0.
Required by:
:curiocity-app:unspecified
> No cached version of com.android.tools.build:gradle:2.0.0 available for offline mode.
I have activated the offline mode.
This is my graddle from generator module
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.greenrobot:greendao-generator:2.2.0'
}
This is my application graddle
buildscript {
repositories {
jcenter()
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 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "XXXXXXXXXXX"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
dexOptions {
incremental true
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(dir: "$buildDir", include: 'native-libs.jar')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.wang.avi:library:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'org.greenrobot:greendao:2.2.0'
compile 'org.greenrobot:greendao-generator:2.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'in.workarounds.typography:typography:0.0.8'
compile 'joda-time:joda-time:2.9.2'
compile('com.github.afollestad.material-dialogs:core:0.8.5.1#aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile project(':sdktools')
compile project(':debugkit')
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
compile files('libs/dropbox-android-sdk-1.6.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
}
Regards

Categories

Resources