I'm trying to update all of my plugins version to the latest one, but I get error :
Execution failed for task ':app:hiltJavaCompileDebug'.
java.lang.IllegalStateException: Unsupported nesting ANONYMOUS
here is my gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.43.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2"
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
&
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdk 33
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.project.test"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "apps")
}
buildFeatures{
viewBinding = true
dataBinding = 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
}
buildTypes {
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "API_BASE_URL", base_url
}
release {
debuggable false
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "API_BASE_URL", base_url
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// hilt
implementation "com.google.dagger:hilt-android:2.43.2"
kapt "com.google.dagger:hilt-android-compiler:2.43.2"
/* hilt viewmodel extension*/
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.5.0"
kapt "androidx.hilt:hilt-compiler:1.0.0"
}
I'm trying to solve the issue but nothing happens. Is there something not compatible with the latest update for the hilt version ? Or do I miss something from my gradle ?
Try downgrading your hilt gradle plugin, it solve my problem.
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
Related
I'm trying to add a library to apply page curl effect animation in android and after adding the dependency and click on sync it worked fine but when I try to run the app its giving me an error as:
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
I searched about it in google and tried different solutions like toggle offline mode and toggle online mode, adding maven { url 'https://maven.google.com' } to project level repositories but nothing worked for me.
I'm attaching the app level gradle file and project level gradle file below.
Any help would be really helpful. Thanks in advance.
app level build.gradle file
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.animations"
minSdk 23
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
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 "com.airbnb.android:lottie:3.4.0"
implementation("androidx.dynamicanimation:dynamicanimation:1.0.0")
implementation 'app.num.numandroidpagecurleffect:numandroidpagecurleffect:1.0'
}
project level build.gradle file
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle file
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "Animations"
include ':app'
I'm trying to implement data transfer between fragments using Safe Args, but I'm stuck at the moment of setting Gradle.
Project Gradle looks like this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module Gradle is like this
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.main_fragmentargs"
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.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 'androidx.legacy:legacy-support-v4:1.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 "androidx.navigation:navigation-fragment-ktx:2.5.0"
implementation "androidx.navigation:navigation-ui-ktx:2.5.0"
}
Wherever I enter this line, Gradle starts to swear.
apply plugin: "androidx.navigation.safeargs.kotlin"
Similar story with
def nav_version = "2.3.3"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
Please tell me how to connect it.
You have to add the plugin to your plugin closure, like described in the documentation.
Add this to your top level build.gradle:
buildscript {
repositories {
google()
}
dependencies {
def nav_version = "2.5.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
...
and this to your app modules build.gradle:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
}
...
Also make sure that android.useAndroidX=true is set in your gradle.properties files.
I have recorded a video using mobile camera but now i want to trim that video using a library, after adding the below dependency for trimming feature.
implementation 'com.github.a914-gowtham:android-video-trimmer:1.7.0'
i am getting this error:
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
Here is my app level build.gradle code:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.techease.videome"
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
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'
//trimmer
implementation 'com.github.a914-gowtham:android-video-trimmer:1.7.0'
}
And here is the project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-
projects/modules.
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
}
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Anyone having idea what i am missing here?
In the android studio from "File" menu call "Invalidate caches..."
After loading android studio build the project again. Every thing will be correct.
below is the gradle file
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 32
defaultConfig {
applicationId "org.classapp.test4"
minSdk 24
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.github.mumayank:AirLocation:2.5.2'
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.android.gms:play-services-maps:18.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Here is the Gradle Module file
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // this line
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error Message
I've been trying to use this github library but it doesn't seem to be working.
So far I have try changing the version but it still doesn't work. Does anyone have any ideas on what to do?
Make sure that Android Studio is able to download the repository.
Open the Preferences, by clicking File > Settings.
In the left pane, click Build -> Execution -> Deployment -> Gradle.
Uncheck/disable the Offline work checkbox.
Click Apply or OK.
After updating buildToolsVersion 25.0.3 to 28.0.3 and build:gradle:2.3.3 to 3.4.0 i have facing with these issue; how to resolve these issues thanks
ERROR: android-apt plugin is incompatible with the Android Gradle
plugin
WARNING: One of the plugins you are using supports Java 8 language
features. To try the support built into the Android plugin, remove
the following from your build.gradle:
apply plugin: 'me.tatarka.retrolambda'
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
Here is my Code Bulid.gradle (module: App)
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.admin.schoolapp"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
//noinspection GradleDependency
annotationProcessor 'org.androidannotations:androidannotations:4.6.0'
//noinspection GradleDependency
implementation 'org.androidannotations:androidannotations-api:4.6.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'commons-io:commons-io:2.4'
implementation 'com.koushikdutta.ion:ion:2.2.1'
implementation 'com.google.code.gson:gson:2.8.5'
}
Bulid.gradle (Project: TestProject)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.7.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
repositories {
mavenLocal()
mavenCentral()
}
task clean(type: Delete) {
delete rootProject.buildDir
}