Android studio gradle sync but non debug - android

I made a project, Gradle sync does succeed but when I run ord debug project the Gradle returns errors, I search on the internet but no luck. I'm a beginner in android studio, someone can do the code of Gradle?
build.gradle(project) :
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.2.1'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(module) :
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android-extensions'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
buildFeatures {
viewBinding = true
}
defaultConfig {
applicationId "com.example.progetto_tpsi"
minSdk 21
targetSdk 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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-database:20.0.5'
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.tools.build:gradle:7.2.1'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
}
settins.gradle :
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "progetto_tpsi"
include ':app'
ERROR:
Task :app:dexBuilderDebug
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.

Related

Failed to resolve in gradle, Unsplash photo picker android studio

I am trying to implement Unsplash API according to this website:
https://unsplash.com/documentation#creating-a-developer-account
But got stuck pretty quickly. I don't know why Gradle refuses to compile so here are some files:
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven { url 'https://jitpack.io' }
}
dependencies {
def nav_version = "2.5.2"
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
}
}
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (App)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
id "kotlin-parcelize"
}
android {
compileSdk 33
defaultConfig {
applicationId "com.example.gallery"
minSdk 21
targetSdk 33
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
}
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.example.gallery'
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"
// Unsplash
implementation 'com.github.unsplash:unsplash-photopicker-android:1.0.1'
// Kotlin
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
// tests
testImplementation "com.google.truth:truth:1.1.3"
testImplementation "android.arch.core:core-testing:1.1.1"
testImplementation 'org.robolectric:robolectric:4.8'
}
All I try to do is to add those lines (from the GitHub specification):
To integrate UnsplashPhotoPicker into your Android Studio project
using Gradle, specify in your project build.gradle file:
allprojects { repositories {
...
maven { url 'https://jitpack.io' } } } And in your app module build.gradle file, replacing x.y.x by the latest tag:
dependencies { implementation
'com.github.unsplash:unsplash-photopicker-android:x.y.z' }
The problem occured(8 similar problem):
Execution failed for task ':gallery:desugarDebugFileDependencies'.
Could not resolve all files for configuration ':gallery:debugRuntimeClasspath'.
Could not find com.github.unsplash:unsplash-photopicker-android:1.0.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/unsplash/unsplash-photopicker-android/1.0.1/unsplash-photopicker-android-1.0.1.pom
- https://repo.maven.apache.org/maven2/com/github/unsplash/unsplash-photopicker-android/1.0.1/unsplash-photopicker-android-1.0.1.pom
Required by:
project :gallery
This question was asked Here but got no answer...
Add the
maven { url 'https://jitpack.io' }
in setting.gradle(project level)
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
//...
maven { url 'https://jitpack.io' }
}
}

How to Fix "Could not parse Android Application Module's Gradle config" in Android Studio

I'm trying to connect Firebase with my project in Android studio, but it keeps showing "Could not parse Android Application Module's Gradle config" error. How do I fix it? I have tried many methods by skimming through related posts here, but none worked.
settings.gradle-
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
rootProject.name = "hissss"
include ':app'
build.gradle-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.1"
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.graddle(:app)-
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.his"
minSdk 22
targetSdk 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 {
//coreLibraryDesugaringEnabled false
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '33.0.0'
buildFeatures {
dataBinding = true
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.3.0')
implementation 'com.google.firebase:firebase-analytics:21.1.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-auth:21.0.6'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation 'com.google.firebase:firebase-storage:20.0.1'
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.6.1'
implementation 'com.android.support:multidex:1.0.3'
}

How can I use com.github.barteksc:android-pdf-viewer in a tv app?

Getting Failed to resolve: com.github.barteksc:android-pdf-viewer:3.2.0-beta.1 when trying to add the package as an dependency.
Also tried to add jCentre as repository but that didn't work.
Suggestion of any other packages would be fine too.
project level gradle -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module level gradle -
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
}
settings.gradle -
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "####"
include ':app'
Thanks in advance
edit your setting.gradle to the following:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
jcenter()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
}
}
rootProject.name = "####"
include ':app'
Include PDFView in your layout:
<com.github.barteksc.pdfviewer.PDFView
android:id="#+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

While adding AdView in xml error is coming as Class referenced in the layout file, com.google.android.gms.ads.AdView, was not found in the project

While adding AdView in xml error is coming as. Class referenced in the layout file, com.google.android.gms.ads.AdView, was not found in the project or the libraries
Cannot resolve class com.google.android.gms.ads.AdView
Can anyone help me on this error. I'm using latest version of Android Studio.
Project - Build.Gradle
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module - Build.Gradle
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "in.xx.xxx"
minSdkVersion 23
targetSdkVersion 31
versionCode 4
versionName "1.0.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.google.firebase:firebase-firestore-ktx:24.0.2'
implementation 'com.google.android.gms:play-services-ads:20.6.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Setting.Gradle
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
include ':app'
rootProject.name = "xx"
By tugging the Gradle my issue resolved after 8 days.

Gradle AndroidStudio: Plugin [id: 'kotlin-android'] was not found in any of the following sources

Trying to add another android project as module to my project i AndroidStudio
in gradle.settings ad do the following:
include ':appmod'
project(':appmod').projectDir = file('/home/john/AndroidStudioProjects/MyIncludeTest/appmod')
and as dependency in build.gradle I add the following:
implementation project(':appmod')
The gradle couldn't fullfill sync because of the following error
Build file '/home/john/AndroidStudioProjects/MyIncludeTest/appmod/build.gradle' line: 3
Plugin [id: 'kotlin-android'] was not found in any of the following sources:
build.gradle (project) in MyIncludeTest
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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
}
build.gradle (module) in myIncludeTest
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myincludetest"
minSdkVersion 26
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
What could be the problem, how do I solve it?

Categories

Resources