NoClassDeFounder Error - android

Getting error while running project with target v 22. I can not change target version.
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
gradle file - build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.adsl.beaconapp"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

Try deleting the build folder and then clean the project

Related

Android Studio throws "No signature of method" error, pointing to build.gradle:app

I got this error after trying to run a Kotlin application through Android Studio:
A problem occurred evaluating project ':app'.
> No signature of method: build_4blexxmb1pl0fsds689m8rkwz.android() is applicable for argument types: (build_4blexxmb1pl0fsds689m8rkwz$_run_closure1) values: [build_4blexxmb1pl0fsds689m8rkwz$_run_closure1#220b09f3]
The error points me to this section of the build.gradle:app file (specifically, the line with android {):
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
buildFeatures {
viewBinding = true
defaultConfig {
applicationId "com.example.bitfighter"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildReleases {
viewBinding = true
}
What does this error message mean, and what can I change to fix the issue?
Try to structure the code like this
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.bitfighter"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
The defaultConfig should always only be in the android clause and not inside the buildFeatures. Other than that, you don't need a buildReleases clause when you already have added a buildFeatures clause.

Gradle project sync failed in importing another module

I'm working on an android app where I tried importing a different module(another project), also tried adding the dependencies of the second module to the first module by going to project structure. But it says Gradle project sync failed and I've posted the screenshots down below.
1st module build gradle
compileSdkVersion 27
defaultConfig {
applicationId "com.example.*****.*****"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
2nd module build gradle
compileSdkVersion 28
defaultConfig {
applicationId "com.example.*****.*****"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Screenshots of output-1
Screenshots of output-2
Please help me out!
Did you try this?
Build > Clean Project
then
Build> Rebuild Project

Gradle related error

I have recently started using the android studio. Just after installing and downloading all the requisite files, I am welcomed by this error,"Failed to find the target with the hash string 'API 27'....", whereas I already have both API 27 and 28 installed (although 28 shows up to be partly installed).
I am completely new to this software.
Tools
SDK
error
you should use like below in gradle
{
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "xxxxxxxxx"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
don't write like compileSdkVersion 'API 27' its compileSdkVersion 27 only

Could not resolve com.android.support:design:27.0.3

I can't build a project with Android 27 as target SDK and 27.0.3 as buildToolsVersion.
My Android studio version is 3.0.1 and I also have google() in my repositories in project's buid.gradle.
I get this error:
> Could not resolve com.android.support:design:27.0.3.
> Failed to download SHA1 for resource 'https://maven.google.com/com/android/support/design/27.0.3/design-27.0.3.pom'.
> For input string: "<!"
Because of there isn't 27.0.3, you can use 27.0.1,27.0.2,27.1.0 instead. You can check the valid revision on here.
As per now use 27.0.2
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.example.packagename"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
implementation 'com.android.support:design:'27.0.2'
Try this code:
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
aaptOptions {
cruncherEnabled = false
}
defaultConfig {
applicationId "com.rokolabs.app.rokostickers"
minSdkVersion 19 // use 19 only use for transition(21)
targetSdkVersion 23
versionCode 117
versionName "0.1.30"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}

Method for arguments with gradle in android studio

Syncing the project files with gradle files in android studio is resulting in the following error
Error:(14, 0) Could not find method applicationId() for arguments [com.amazon.mysampleapp] on project ':app' of type org.gradle.api.Project.
where the gradle file reads
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
applicationId "com.amazon.mysampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
What is happening here? Removing applicationID moves the error to minSdkVersion
The applicationId doesn't go inside the android block, but instead your buildConfig block:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "com.example.my.app"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
Pulled that from this page about applicationId: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

Categories

Resources