I am trying to create a library in android studio by following this official documentation. But in this particular project, I am facing this issue. if I create new project and create new lib I don't face any issue. It means something is wrong with this project only.
My Lib Gradle
plugins { id 'com.android.library' }
android {
namespace 'com.android.mylib'
compileSdkVersion 33
defaultConfig {
minSdkVersion 26
targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
App Gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 33
buildToolsVersion "30.0.2"
testBuildType "beta"
defaultConfig {
applicationId "com.app.etc"
minSdkVersion 23
targetSdkVersion 33
versionCode 327
I have searched some questions, but according to those answers, everything seems correct. i have invalidated cache and restarted the android studio as well.
Here is the error.
A problem occurred evaluating project ':mylibrary'
Caused by:
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method namespace() for arguments [com.example.mylibrary] on extension 'android' of type com.android.build.gradle.LibraryExtension.
That is the problem with the Gradle version used in the app some plugins want latest version of the Gradle
Try to change the Gradle version in:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With