I have got an awkward problem on my Android App. When i build my app on Android Studio, build ends with 704 errors but app works on my test device correctly. I can't figured out the problem. I searched on Google and found some answers in stackoverflow but they did not help me. Because i don't use proguard right know on my project and the answers are all about proguard.
And below codes are my app level 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'
apply plugin: 'com.google.gms.google-services'
repositories {
maven {
url "http://dl.bintray.com/piasy/maven"
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "***.***.***"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'Boolean', 'crashlyticsEnabled', 'true'
buildConfigField 'Boolean', 'logEnabled', 'true'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'Boolean', 'crashlyticsEnabled', 'true'
buildConfigField 'Boolean', 'logEnabled', 'false'
}
}
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'
exclude 'META-INF/rxjava.properties'
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile "com.android.support:recyclerview-v7:23.1.1"
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile project(':chatlibrary')
compile 'com.amazonaws:aws-android-sdk-sns:2.2.14'
compile 'com.norbsoft.typefacehelper:library:0.9.0'
compile 'com.github.piasy:rxscreenshotdetector:1.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:2.0.6#aar') {
transitive = true;
}
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.github.GDG-Korea:PinterestLikeAdapterView:29697e2c24'
}
Thanks for your helps...
Related
I have an app already published on the store, after upgrading to Android Studio 3 (now 3.1) and the forced update of gradle I am unable to import my external projects as modules.
I have tried removing all my modules and adding them one by one, deleting the cache, changing gradle version, and compileSdkVersion but it doesn't work.
When I try to sync gradle I receive some messages like this:
Unable to resolve dependency for ':app#produzioneDebug/compileClasspath': Failed to transform file 'ShareLib-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
This is in my settings.gradle to make external project available:
include ':app'
include ':ShareLib'
project(':ShareLib').projectDir = new File('..//ShareLib//')
This is my build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven {
url 'https://repo.spring.io/libs-milestone'
}
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def AAVersion = '4.4.0'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.0.0"
applicationId "com.xxx.app"
// Enabling multidex support.
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": android.defaultConfig.applicationId]
}
}
}
signingConfigs {
releaseSigning {
///
}
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
release {
// proguard
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources false
zipAlignEnabled true
signingConfig signingConfigs.releaseSigning
}
}
flavorDimensions "tier"
productFlavors {
dev {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "development.xxx.app"
}
coll {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "test.xxx.app"
}
prod {
buildConfigField "String", "SERVICE_URL_BASE", "\"www.xxx.com/xxx-rest\""
applicationId "com.xxx.app"
}
}
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'
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(path: ':shareLib', configuration: 'default')
// implementation project(path: ':shareLib', configuration: 'default') {
// exclude module: 'jsr305'
// }
// compile fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.squareup:otto:1.3.8'
implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
annotationProcessor "org.androidannotations:rest-spring:$AAVersion"
implementation "org.androidannotations:rest-spring-api:$AAVersion"
annotationProcessor "org.androidannotations:otto:$AAVersion"
implementation "org.androidannotations:otto:$AAVersion"
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
// support AA on Android < 5
// compile 'com.android.support:multidex:1.0.1'
implementation 'com.github.markomilos:paginate:0.5.1'
// mpandroid
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
// crashlytics fabric
implementation('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true
}
// recaptcha
implementation ('android.lib.recaptcha:reCAPTCHA:2.0.0') {
exclude group: 'com.android.support'
}
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
}
I have solved opening modules project one by one and doing this for each one:
Project Structure -> Project -> Gradle Version = 4.7
Settings -> Build, Execution, Deployment -> Compiler -> Uncheck "Configure on demand"
Rebuild project once you can see your .aar file into build/outputs/aar
Then repeat these steps for main project module
Hy! I am having following problem in my Android project
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/net/compatibility/WebAddress.class
I Know this is because of conflict in dependencies. I looked into dependencies but not able to configure which dependencies causing this issue. I am pasting my gradle code bellow
Module 1 :
android {
//useLibrary 'org.apache.http.legacy'
compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
}`sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['res']
}
test {
java.srcDirs = ['src/test/java']
}
}`compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7` }
packagingOptions {
exclude 'META-INF/ASL2.0'
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'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}`lintOptions {
abortOnError false
}
checkstyle {
ignoreFailures = true
}
buildToolsVersion '25.0.3'`}`dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':webViewMarker')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.squareup:otto:1.3.8'`}`
Module 2
apply plugin: 'com.android.library'`ext {
bintrayRepo = 'maven'
bintrayName = 'folioreader'
publishedGroupId = 'com.folioreader'
libraryName = 'WebViewMarker'
artifact = 'webViewMarker'
libraryDescription = 'An epub reader for Android'
siteUrl = 'https://github.com/FolioReader/FolioReader-Android'
gitUrl = 'https://github.com/FolioReader/FolioReader-Android.git'
libraryVersion = '0.2.5'
developerId = 'mobisystech'
developerName = 'Folio Reader'
developerEmail = 'mahavir#codetoart.com'
licenseName = 'FreeBSD License'
licenseUrl = 'https://en.wikipedia.org/wiki/FreeBSD_Documentation_License#License'
allLicenses = ["FreeBSD"]`}`android {
compileSdkVersion 19
buildToolsVersion '25.0.3'
defaultConfig {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}`
}
apply from: '../folioreader/bintray/installv1.gradle'
apply from: '../folioreader/bintray/bintrayv1.gradle'
Main Module
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 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.ebook.stev_ebook"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':folioreader')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.stripe:stripe-android:+'
compile('com.twitter.sdk.android:twitter:1.3.2#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.google.android.gms:play-services-plus:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
Please comment this
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
Try Rebuilding again. Since it's a third party library , there is a chance that it might be causing the trouble
It means you are using different version of support and all android libraries for example you are using support library version 25.0.1 in one module and version 22.2.1 in another and of course you should add just one of these library to your dependencies when you add one library in one module you should not add it to build.gradle file of second.
Solution : remove duplicate libraries.
I have downloaded Kaltura SDK and integrated into my project, I got below error, but when I ran demo application, I could run it.
Error:Execution failed for task ':playerSDK:transformNative_libsWithSyncJniLibsForRelease'.
> java.io.FileNotFoundException: /Users/aaaa/AndroidWorkplace/MediaShare/playerSDK/build/intermediates/bundles/release/jni/lib/armeabi/libHLSPlayerSDK.so (No such file or directory)
This is my 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' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.aaaa.testSample"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "0.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':playerSDK')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile ('org.apache.httpcomponents:httpmime:4.5'){
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#11sd') {
transitive = true;
}
compile files('libs/gson-2.2.4.jar')
}
Any support on this?
When i create an Signed APK it gives an error:
Error:Execution failed for task :app:shrinkReleaseMultiDexComponents.
java.io.IOException: The output jar [G:\D drive\CommunityMatrimony\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.
This is my Gradle File:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'xxxx'
keyPassword 'xxxx'
storeFile file('F:/CMJAR.jks')
storePassword 'xxxx'
}
}
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.xxxx.yyyy"
minSdkVersion 11
targetSdkVersion 22
versionCode 42
versionName "2.8.2"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
productFlavors {
}
compileOptions.encoding = 'ISO-8859-1'
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
repositories {
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
flatDir {
dirs 'libs'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/AF-Android-SDK-v2.3.1.18.jar')
compile(name: 'gamooga-livechat-client-release', ext: 'aar')
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'org.apache.httpcomponents:httpmime:4.2.1'
compile 'com.koushikdutta.async:androidasync:2.1.6'
compile 'in.juspay:godel:0.6.6'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:multidex:1.0.1'
}
Configuring Android Annotations is quite irksome. But I finally figured out a solution and wish to share with everyone.
Use the below mentioned gradle buildscript.
Following are some of the references:
1) https://github.com/excilys/androidannotations/blob/develop/examples/gradle/build.gradle
2) https://bitbucket.org/hvisser/android-apt
3) http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
mavenCentral()
}
ext.androidAnnotationsVersion = '3.0.1';
configurations {
apt
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
useOldManifestMerger true
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
}
dependencies {
compile 'com.android.support:support-v4:20.0.+'
compile 'com.android.support:appcompat-v7:20.0.+'
apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
compile fileTree(dir: 'libs', include: '*.jar')
}
apt {
arguments {
resourcePackageName 'com.yourpackage.name'
androidManifestFile variant.processResources.manifestFile
}
}