Duplicate class android.support.v4.All kind - android

Duplicate class
android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat
found in modules classes.jar
(com.android.support:support-compat:28.0.0) and classes.jar
(com.android.support:support-v4:24.0.0)
and so on so many errors like this
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.sakhi.live_scoure"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.gms:play-services:10.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation files('libs/awais.jar')
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation project(':dBPullToRefresh')
}
apply plugin: 'com.getkeepsafe.dexcount'

you are using older GCM Service, you can resolve by replace this line 'com.google.android.gms:play-services:10.0.1' To 'com.google.android.gms:play-services-gcm:16.1.0'
by replacing this line you can resolve but i will suggest you to upgrade GCM to FCM (firebase messaging) because GCM is now shutdown his services.

Related

I was just building the app using source code and found these issues

How can I solve this issue? I tried searching in YouTube and Chrome couldn't find the relevant solution for this. There are three issues faced. I tried changing various things in settings and tried different solution but none of those helped
THIS IS BUILD.GRADLE (app):
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion '29.0.1'
defaultConfig {
applicationId "com.pdf.scanner.queenscanner"
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName '1.1'
multiDexEnabled true
//Photo editor
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
//Photo editor
dataBinding {
enabled = true
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
repositories {
maven { url "http://jitpack.io" }
//tedpicker
maven { url "http://repo.commonsware.com.s3.amazonaws.com" }
maven { url "http://s3.amazonaws.com/repo.commonsware.com" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
//Add library
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//hungdh
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(':openCVLibrary310')
//Photo editor
// annotationProcessor 'ly.img.android:photo-editor-sdk:2.0.27'
// compile 'ly.img.android:photo-editor-sdk:2.0.27'
//OCR
implementation 'com.rmtheis:tess-two:6.1.1'
implementation 'com.github.mthli:Knife:v1.1'
//Opennote
implementation 'com.google.zxing:core:3.3.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//compile 'com.github.ctodobom:OpenCV-3.1.0-Android:9e00ee4218ca0c9e60a905c9f09bf499f9dc5115'
implementation 'us.feras.mdv:markdownview:1.1.0'
implementation 'com.github.ctodobom:drag-select-recyclerview:0.3.4.ctodobom.sections'
implementation 'com.github.nostra13:Android-Universal-Image-Loader:v1.9.5'
implementation 'com.github.ctodobom:FabToolbar:3c5f0e0ff1b6d5089e20b7da7157a604075ae943'
//Simple document scanner
implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
implementation 'com.jakewharton.timber:timber:4.1.2'
//ImagetoPDF
implementation project(':tedpicker')
implementation project(':photo-editor-sdk-2.0.27')
implementation 'com.itextpdf:itextg:5.5.9'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.jakewharton:butterknife:10.2.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
//Auto mail
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
implementation 'com.github.nextcloud:android-library:-SNAPSHOT'
//filter_image
implementation 'it.chengdazhi.styleimageview:styleimageview:1.0.4'
//photoview
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.google.android.gms:play-services-ads:21.3.0'
//sửa là lỗi (lúc có firebase-core)
//implementation files('/libs/photo-editor-sdk-2.0.14.aar')
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.facebook.android:facebook-android-sdk:5.13.0'
implementation 'com.facebook.android:audience-network-sdk:5.8.0'
implementation project(path: ':dynamicgrid')
}
You could download the corresponding JAR file directly from the package's Maven repository site and put it into the libs directory of your project. This earlier Stackoverflow thread might be helpful in the details.

Error extracting an `.aab` file: Invalid dex file indices, expecting file 'classes٢.dex' but found 'classes2.dex'

This error appears when I extract a file aab:
Invalid dex file indices, expecting file 'classes٢.dex' but found 'classes2.dex'.
my Gradle app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.rewardstom.win"
minSdkVersion 19
multiDexEnabled true
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.android.volley:volley:1.2.0'
implementation 'com.facebook.android:facebook-login:7.1.0'
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.google.firebase:firebase-dynamic-links'
implementation "androidx.browser:browser:1.3.0"
//Ads
implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
implementation 'com.google.android.gms:play-services-basement:17.6.0'
api 'com.tapjoy:tapjoy-android-sdk:12.8.0#aar'
implementation 'com.fyber:offerwall-sdk:9.2.2'
implementation 'com.applovin:applovin-sdk:10.2.1'
implementation 'com.adcolony:sdk:4.5.0'
implementation 'com.chartboost:chartboost-sdk:8.2.0'
implementation 'com.ironsource.sdk:mediationsdk:7.1.7'
implementation 'com.github.vungle:vungle-android-sdk:6.7.1'
implementation 'com.facebook.android:audience-network-sdk:6.5.1'
//noinspection GradleDependency
implementation 'commons-io:commons-io:2.4'
}
apply plugin: 'com.google.gms.google-services'
One temporary solution that may work is to set
release {
minifyEnabled false
.......
}
This will reduce your app size which may cause it to use only one dex file.
If this didn't work, you need to change your Windows display language to a language that uses. Arabic Numerals (including your Administrative language settings).

Type org.json.JSONException is defined multiple times

when I am generating signed APK in android this error is coming again and again,and jetified-jav-json file is opening.this is may be due to my gradle file --This is error generated by android studio --
Type org.json.CDL is defined multiple times: C:\Users\91971.gradle\caches\transforms-2\files-2.1\4ff16b76dc52b01ac4898d797a9f3375\jetified-java-json.jar:org/json/CDL.class, C:\Users\91971\AndroidStudioProjects\APS-Money-updated\aeps_lib-1July\build.transforms\832bfa6b3f0d8c75ed631f792cb4e02d\jetified-aeps_lib-1July-runtime.jar:org/json/CDL.class
this is my build.gradle--
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'AndroidManifest.xml'
}
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.aps.apsmoney"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionName "1.0"
versionCode 1
//versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
aaptOptions { cruncherEnabled = false }
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
zipAlignEnabled true
debuggable = false
jniDebuggable = false
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:design:28.0.0'
implementation files('libs/org.apache.http.legacy.jar')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation files('libs/signpost-core-1.2.1.2.jar')
implementation('de.keyboardsurfer.android.widget:crouton:1.8.5#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/java-json.jar')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(':aeps_lib-1July')
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.journeyapps:zxing-android-embedded:3.3.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'androidx.multidex:multidex:2.0.1'
}
This is due to some unused dependency i had added...remove unsused dependency and problem get resolved....kindly remove dependency one by one check which dependency is effecting project....It tooked about 1 week for me to find thid bug...

Duplicate class android.support.v4.app.ActionBarDrawerToggle found in modules classes.jar

When I am attempting to run my app in Android studio I am getting the following error:
Duplicate class android.support.v4.app.ActionBarDrawerToggle found in
modules classes.jar
Along with other duplicate class complaints.
I've tried modifying the build.gradle file, but I have little luck fixing the issue. Not sure how I can prevent this error from happening.
Here is my build.gradle file.
android {
compileSdkVersion 28
//buildToolsVersion '26.0.2'
//buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.app"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
// RecyclerView
implementation 'com.android.support:recyclerview-v7:28.0.0'
// CardView
implementation 'com.android.support:cardview-v7:28.0.0'
// Glide
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.google.android.gms:play-services-appindexing:8.4.0'
// floating buttons
implementation 'com.github.clans:fab:1.6.4'
// Time Square (Calendar)
implementation 'com.squareup:android-times-square:1.7.0#aar'
}

Error: Program type already present: com.facebook.ads.Ad

I am trying to implement facebook sdk according to this,
https://developers.facebook.com/docs/audience-network/android
When I trying to compile it im getting this error.
Error: Program type already present: com.facebook.ads.Ad
I'm using android studio 3.2.1
this is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.test.test"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.facebook.android:facebook-core:[4,5)'
implementation 'com.facebook.android:facebook-marketing:[4,5)'
implementation 'com.android.support:recyclerview-v7:25.3.1' // Required Dependency by Audience Network SDK
implementation 'com.facebook.android:audience-network-sdk:5.+'
// More deps here //
}

Categories

Resources