Gradle Build Failure version 7.1.3 - java

I'm having trouble building my gradle file. I recently upgraded my gradle version form 7.1.2 on gradle-wrapper-properties, build.gradle files and added implementation 'com.android.tools.build:gradle:7.1.3' and see below error message when building with gradle:
Could not find com.android.tools.build:gradle:7.1.3. Searched in the following locations: - plugins.gradle.org/m2/com/android/tools/build/gradle/7.1.3/… If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration. Required by: project :app Add google Maven repository and sync project Open File
Below is my build.gradle(Project level) file :
apply '7.1.3'
buildscript {
ext {
agp_version = '7.1.3'
}
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
classpath "com.android.tools.build:gradle:$agp_version"
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.wallpapers_8k_Celebrity_Art.app"
minSdkVersion 19
targetSdkVersion 31
versionCode 16
versionName "alpha1.016"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.facebook.android:audience-network-sdk:6.8.0'
implementation 'com.android.tools.build:gradle:7.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.4'
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.google.android.material:material:1.5.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
implementation 'com.applovin:applovin-sdk:+'
}
Updated properties file :
#Sun Apr 10 14:07:23 EAT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Below is a screenshot under my project Structure setting :

As this is a new version (released at 2022-04-08), you need google() repository for recent release, as stated in Android Developer Documentation
repositories {
...
google()
}

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.

I am simply not able to bring the PAHO / Eclipse MQTT Android Service into an Android Studio project

I am simply not able to bring the PAHO / Eclipse MQTT Android Service into an Android Studio project. It says "A problem occurred evaluating project ':app'." I have added the required dependencies in the build.gragle(module) file.
Bellow, I will add the full build.gradle file. including the full error.
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.mqqttestapp"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
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
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
}
error
Build file 'C:\Users\*****\MQQTtestApp\app\build.gradle' line: 30
A problem occurred evaluating project ':app'.
> Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app\build.gradle'
GOTO settings.gradle and replace
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
with
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
That installed MQTT lib into my project.

Android - Firebase phone auth IncompatibleClassChangeError

I am trying to integrate the firebase phone authentication but getting IncompatibleClassChangeError stack trace attached beloew, I have attached my root/app level Gradle files as well.
I have used
This code
from google's snippet repository.
I have followed each step correctly as mentioned in the documentation.
I have added sha1 and sha256 fingerprints
I have also tried to correct Gradle version and firebase dependency with no luck.
Error Log:
My app level gradle
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.aihighway.aihscreening"
minSdkVersion 21
targetSdkVersion 30
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 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.airbnb.android:lottie:3.7.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.gordonwong:material-sheet-fab:1.2.1'
implementation 'com.github.AnyChart:AnyChart-Android:1.1.2'
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.MackHartley:RoundedProgressBar:2.1.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.firebase:firebase-auth:21.0.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.0'
implementation 'com.google.firebase:firebase-core:19.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
My root level build.gradle
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
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()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I've managed to find a workaround, I downgraded the firebase version to 20.0.0 and it worked for me

Failed to resolve: com.android.support:appcompat-v7:jar

I am newbie in Android Studio Platform. I am getting this error
" Failed to resolve: com.android.support:appcompat-v7:jar "
Currently my version Android Studio is 3.5.0.
I Have added google() on build.gradle repositories
This is my build.gradle (Project)
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my build.gradle (Module app)
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.kartik.barcode"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:jar:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
//implementation 'com.android.support:design:jar:28.0.0-alpha1'
implementation 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
implementation 'com.google.zxing:core:3.2.0'
// implementation 'com.android.support:design:jar:28.0.0-alpha1'//for The edittext animation
implementation 'com.google.firebase:firebase-database:9.0.0'//for firebase
implementation 'com.google.firebase:firebase-auth:9.0.0'
implementation 'com.google.firebase:firebase-storage:9.0.0'
implementation 'com.google.android.gms:play-services-auth:9.0.0'
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
}
I am still getting this error:
ERROR: Failed to resolve: com.android.support:appcompat-v7:jar
Show in Project Structure dialog
Affected Modules: app
You should use PROPER version. There is no jar in this dependency.
Use stable
implementation 'com.android.support:appcompat-v7:28.0.0' //28.0.0-alpha1
FYI
Please fix the version conflict either by updating the version of the
google-services plugin or or updating the version of
com.google.android.gms to 11.4.2
You should upgrade below version
implementation 'com.google.android.gms:play-services-auth:17.0.0'
It will be good approach if you use upgraded classpath
classpath 'com.google.gms:google-services:4.2.0'

How to fix "Cause: invalid type code: 8F"

Cause: invalid type code: 8F this error raise when try to take apk build.
Already I tried.. -- clean and rebuild -- Invalidate and restart -- jdk path setting -- experimental option
Android studio version 3.3.1
gradle version -- classpath 'com.android.tools.build:gradle:3.2.1'
project level gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.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()
mavenCentral()
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app level gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'nl.psdcompany:duo-navigation-drawer:2.0.6'
apply plugin: 'com.google.gms.google-services'
}
I attached my app and project level gradle file.

Categories

Resources