Android studio gradle sync issues - java

below is code of build.gradle project level
i ahvent opened it since few days before it was working now its give error as shown in image
i have tried updating gradle version
i have invalidate cache and restart
but nothing is working any help appriciated
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter { url "http://jcenter.bintray.com/"}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter { url "http://jcenter.bintray.com/"}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buidl.gradle 9app level
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxxx.jks')
storePassword 'xxxx'
}
}
compileSdkVersion 28
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "xxxx"
minSdkVersion 18
targetSdkVersion 28
versionCode 13
versionName "1.0.13"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
productFlavors {
FREE {
minSdkVersion 18
applicationId 'XXXX'
signingConfig signingConfigs.config
targetSdkVersion 28
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
versionCode 13
versionName '1.0.13'
}
}
flavorDimensions "versionCode"
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta4'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'de.codecrafters.tableview:tableview:2.5.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'

Related

Unable to load class 'com.android.tools.lint.model.LintModelModuleLoaderProvider'

I am working on a project where I help a client to add some features to an app that has been created previously about a year back. I made the changes and have been running into problems while trying to build the project and generate bundle, I have checked round stack overflow and haven't found a solution yet. Please have a look
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath 'com.android.tools.lint:lint:30.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.android.support:appcompat-v7:28.0.0'
classpath 'com.android.support:support-v4:28.0.0'
}
}
//plugins {
// id 'com.android.application' version '7.2.0' apply false
// id 'com.android.library' version '7.2.0' apply false
//}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://maven.google.com/"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is the app gradle
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 32
defaultConfig {
applicationId "kubet.rhdev.maze"
minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.android.support:multidex:2.0.1'
implementation 'com.google.android.gms:play-services-ads:19.6.0'
implementation platform('com.google.firebase:firebase-bom:30.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-database:20.0.6'
}
the debug log says
Unable to load class 'com.android.tools.lint.model.LintModelModuleLoaderProvider'.
This is an unexpected error. Please file a bug containing the idea.log file.

Cause: org.jetbrains.plugins.gradle.tooling.util Error

come easy,
I'm trying to get all the combinations but I can't get an error, I can't figure it out. The reason is:Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
More information
Gradle sync failed: Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
Consult IDE log for more details (Help | Show Log) (734 ms)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "pubg.looter.map"
minSdkVersion 22
targetSdkVersion 29
versionCode 2
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.android.gms:play-services-ads:18.1.0'
}
// 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.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// 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
}

Program type already present: android.support.v4.R

I am trying to generate a signed apk and I am getting the error:
Program type already present: android.support.v4.R
I have tried excluding support-v4 from some dependencies. But that didn't help. I have searched for answers but none couldn't solve mine.
But the app runs in debug mode fine.
Thank you very much for your time and assistance in this matter.
Here's my gradle app file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.android.puchotask1"
minSdkVersion 15
targetSdkVersion 27
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(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'ai.api:sdk:2.0.7'
implementation 'ai.api:libai:1.6.12'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.dnkilic.waveform:waveform:0.9.3'
}
apply plugin: 'com.google.gms.google-services'
gradle project file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.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
}
You need to exclude the support appcompat-v7 from this dependency:
implementation 'com.dnkilic.waveform:waveform:0.9.3'
with this:
implementation ('com.dnkilic.waveform:waveform:0.9.3') {
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
}

Unable to MergeDex in Android Studio after updating Firebase and Google play services

The error which I am receiving is this:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.monmos"
minSdkVersion 21
targetSdkVersion 27
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'
}
}
buildToolsVersion '27.0.3'
productFlavors {
}
}
android {
defaultConfig {
multiDexEnabled true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
//Libraries
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-messaging:12.0.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
This is my project build.gradle project:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have updated the firebase version from 10.2.0 to 12.0.0 and the app is bringing up an error saying telling me to merge dex. I think 2 libraries are clashing.
This is because the following Firebase-UI:
implementation 'com.firebaseui:firebase-ui-database:3.1.1'
Has a strict dependencies of:
Firebase/Play services version 11.6.2
Support Library version 27.0.1
So, you need change the dependencies according to it.
You can view the documentation in case you need to use the recent supported Firebase/Play service at Firebase-UI for Android.

gradle proj sync failed, every methods tried

error message:
Error:Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Open File<br>Show Details
This error is along with tons of similar dependencies errors.
methods tried:
clear caches
reinstall android studio
download the latest Gradle and replace the original one.
4. Play with the build.gradle file and add several lines
I am just a student who wants to start some android project with java.
Thanks in advance.
Here's my up-level gradle file:
// 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
}
here's my gradle file for my proj:
apply plugin: 'com.android.application'
repositories {
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
jcenter()
google()
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2" // -------------------> Add this
defaultConfig {
applicationId "com.example.alexs.applicationone"
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'
}
debug {
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 'com.android.support.test.espresso:espresso-core:3.0.2-alpha1'
}
my sdk version is 27 btw.
Add buildToolsVersion "26.0.2" to build.gradle file like below :
android {
compileSdkVersion 26
buildToolsVersion "26.0.2" // -------------------> Add this
defaultConfig {
applicationId "com.example.alexs.applicationone"
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'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
In your top-level build.gradle file, not the app module one you posted, add the following block:
allprojects {
repositories {
google()
}
}
Or in your app/build.gradle file (the one you posted) add the google repository:
repositories {
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
jcenter()
google()
}

Categories

Resources