I am developing small Android app
but I execute the code it showing something like this I didn't understand what is going on.Please help me
My gradle file like this
please help me to out of this problem
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.chinni.swipetabs"
minSdkVersion 8
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
}
You are building a debug application. If you choose to building a release application, sources will be different(encrypt).
Related
After adding a dependency to "androidx.security:security-crypto:1.0.0-alpha02", I get the error message "More than one file was found with OS independent path 'build-data.properties'." I have tried to correct it by changing the version of the library (1.1.0-alpha01; 1.0.0-alpha02; 1.0.0-alpha01) and modifying the packageoptions section as I have found on the net but nothing has worked. Thanks for your help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.skcc.myapp"
minSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable false
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-vision:11.8.0'
implementation "androidx.security:security-crypto:1.0.0-alpha02"
//
}
I found solution at Android Studio: Duplicate files copied in APK META-INF/DEPENDENCIES when compile
Regards
packagingOptions {
pickFirst '**'
}
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/measurement/zzabn.class
This error shown while generating signed apk.
here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.jhaider.livefootballmatchesofworldcup"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/maven/pom.properties'
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/gson/FieldAttributes.class'
exclude '.readme'
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "app-type"
productFlavors {
live1016 {
applicationId "com.jhaider.livefootballmatchesofworldcup"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
dimension "app-type"
}
videohighlights {
applicationId "com.jhaider.livefootballmatchesofworldcup.videohighlights"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
dimension "app-type"
}
}
sourceSets {
live1016 {
java {
srcDir 'src/live1016/java'
}
resources {
srcDir 'src/live1016/res'
}
}
videohighlights {
java {
srcDir 'src/videohighlights/java'
}
resources {
srcDir 'src/videohighlights/res'
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.firebase:firebase-invites:15.0.0'
compile 'com.google.firebase:firebase-messaging:15.0.0'
compile 'com.google.firebase:firebase-ads:15.0.0'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.firebaseui:firebase-ui-auth:3.2.2'
compile ('com.google.android.gms:play-services-auth:15.0.0'){
force=true
}
compile ('com.google.android.gms:play-services-location:15.0.0'){
force=true
}
compile project(':StartAppInApp-3.6.7')
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.okhttp3:okhttp:3.3.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.squareup.picasso:picasso:2.5.2'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
I solved by upgrading all the firebase dependencies on build.gradle from 15.0.0 to 15.0.2 where available.
Go to https://firebase.google.com/docs/android/setup for latest versions available and note that latest version for com.google.firebase:firebase-ads is 15.0.0 and latest version for com.google.firebase:firebase-messaging is 15.0.2
Delete assets folder entry in the android studio (not from actual folder location). Then do a clean build.
Rather than downgrade or upgrade library, it would better to exclude one or more of the same class from different versions. For example, if you know from which module the class is from, you can use:
compile('com.google.android.gms:play-services-auth:15.0.0') {
exclude group: 'com.google.android.gms', module: 'module.of.dependecy,withconfllict'
}
I am getting the following error when I try to build my project. This error occurs when I was trying to add JavaMail api in my project.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> More than one file was found with OS independent path 'META-INF/mailcap.default'
This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.persi.eatery"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
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 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-database:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.sun.mail:android-mail:1.6.1'
compile 'com.sun.mail:android-activation:1.6.1'
compile project(':library')
}
apply plugin: 'com.google.gms.google-services'
My library gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
I have tried to implement the following solution which I found on the similar question:
On gradle:3.0.0 More than one file was found with OS independent path 'META-INF/ASL2.0'
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'
}
But it does not solve the problem.
Ps I have not much idea about gradle files
when i try to add the jar files to my project i got the error like Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
org/apache/http/annotation/Immutable.class in android studio
build.gradle
ultConfig {
applicationId "com.syzygy.extreme.uploadexample"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.0.jar')
}
Try this out for http core and mime. 100% working
android {
repositories {
mavenCentral()
}
android {
useLibrary 'org.apache.http.legacy'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.abcd"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
testCompile 'junit:junit:4.12'
}
The problem is happening after I add the Realm Library to my project. I have this dependences in my gradle project:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
I Found a lot of answers in the StackOverflow and I tested many of this but i have no success. Tryied this answer and this answer but i think my problem is something more specific.
I also added the suggestion of the LogCat error, but im getting the same error. Any answer will be appreciated.
I provide an image of the full error for a better look.
Move your android closure to be after the dependencies closure:
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
The LogCat show this error Gradle DSL method not found: 'packagingOptions()'
Then you do not have packagingOptions inside android.
This is the packagingOptions { I use to typically be able to build anything so far.
android {
...
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
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/services/javax.annotation.processing.Processor'
}
}