ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android() is applicable for argument types: (build_ap86oam3dut3pxce3x49rdtma$_run_closure1) values: [build_ap86oam3dut3pxce3x49rdtma$_run_closure1#47588b04]
The build gradle is:
apply plugin: 'com.android.application'
android{
implementationSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.uiresource.taksiku"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:$var"
implementation 'com.android.support:design:28.0.0'
testimplementation 'junit:junit:4.13'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta5'
implementation 'de.hdodenhof:circleimageview:3.1.0'
}
If you are using kotlin version 1.4.21 or newer, kotlin-android-extension is deprecated.
So if you removing the plugin you also have to remove the android experimental extension block.
In my case, I had to remove these pieces of code.
apply plugin: 'kotlin-android-extensions'
androidExtensions {
experimental = true
}
But if above did not fix it
This a kind of general and/or wrapping error which hides the real cause and/or problem, hence to see actual error message, try something like:
./gradlew :app:assembleDebug --stacktrace
And search for resulting real error-message instead.
I had the same error message until I commented out everything in the android plugin except the compile sdk version, trying to get back to a successful build config.
android {
compileSdkVersion 23
/*
...
*/
}
Then, I started uncommenting things until I narrowed the problem down to using the following incorrectly.
ProductFlavors {
...
}
I'm not sure if you're using the same block, but at the moment, I'm leaving it commented out because I'm not sure it's needed. Once I got rid of it though, I was receiving other errors about sdk root dir location, so I was able to fix those.
I hope this helps!
I was getting a similar error because the versionCode was being taken from a properties file, but the versionCode needs to be an integer and not a string, so toInteger() was needed.
Nice logs, android.
Best thing you can do is comment parts of your build.gradle file related to the issue until you get a good build and them uncomment 1 by 1 until you find the problem. I had the same error and it was related with a typo in one of the app build.gradle blocks. I was using:
android {
...
buildFeature {
...
}
}
instead of
android {
...
buildFeatures {
...
}
}
Good luck!
This is a syntax error somewhere in your gradle file inside the android {} closure. If you are someone having this same problem then the best solution to this problem is to comment out portions of code inside android {} and keep running gradle sync until you have a successful build. Then slowly add back commented out lines until you find the culprit.
in my case I needed to comment out this lines in gradle
androidExtensions{
experimental = true
}
This issue is usually related to some change on build.gradle file, for example in my case, was this line in the defaultConfig section on that file:
versionCode 1.1
I changed it to:
versionCode 2
and problem fixed.
I removed this code from my Gradle:
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
In Android Studio 2021.1.1 Canary 12, I removed
plugins{
...
id 'kotlin-android-extensions'
}
But forgot to remove this from
android{
androidExtensions {
experimental = true
}
}
after removing androidExtension block my problem solved
I was checking a very old project from Github and found the solution by matching the app level build.gradle file with my current project, hence the solution is to replace
runProguard false
with
minifyEnabled false
It must've been deprecated and removed in a later build which caused a similar issue - No signature of method: build_6f958jjxpxn7lllu9wu5brezx.android()
There's no unique solution for this error, except that it's a syntax error inside build.gradle file.
I'm using JAVA, but for some reason Android Studio added kotlinOptions into android block without my knowledge. And then the same error happened. I put here just in case someone need it.
android {
// ...
// remove this block if you are using Java
kotlinOptions {
jvmTarget = '1.8'
}
// ...
}
It is because there's syntax error in android{..} part of build.gradle
You've used implementationSdkVersion which should ideally be compileSdkVersion. Error in variable names in android{..} leads to such errors.
TLDR;
Replace implementationSdkVersion with compileSdkVersion
I just removed useProguard true in build.gradle > android > buildTypes, and it worked for me.
i was trying to add parcelable plugin in my project. this was the same error in my case too. Because, JetBrains extracted the Parcelize from Kotlin Android Extensions to a new plugin, kotlin-parcelize
So, If you want to add easy parcelable in kotlin then follow these steps:
First you will need to add kotlin-parcelize plugin to your module
plugins {
..
id 'kotlin-parcelize'
}
Then change your old import statement from
import kotlinx.android.parcel.Parcelize
to
import kotlinx.parcelize.Parcelize
Example:
import kotlinx.parcelize.Parcelize
import android.os.Parcelable
#Parcelize
class User(
val name: String,
val age: Int
): Parcelable
I'm new to Android but i got a message similar to yours today when i try to use a different version (not the suggested ones) of the Gradle plugin and gradle engine on Android Studio 4.1 canary.
When I had on my App build.gradle these lines:
task wrapper(type: Wrapper){
gradleVersion = '5.6.4'
}
and on my build.gradle for the module this line
classpath 'com.android.tools.build:gradle:3.6.3'
This was the message i got with previous settings:
A problem occurred evaluating project ':app'.
> No signature of method: build_5dcjpn4h9nkpym0yszxs5w2uh.android() is applicable for argument types: (build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1) values: [build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1#2e4515b3]
The way i found to solve this error was changing version for the gradle plugin on my build.gradle for the module like this
classpath 'com.android.tools.build:gradle:4.0.0'
I hope this could help you.
Happy coding!
For me I had updated firebase-crashlytics-gradle from 2.5.2 to 2.7.1 in my project build.gradle and that caused the issue.
dependencies {
[...]
classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.1
}
I removed an unnecessary firebaseCrashlytics configuration in my app module build.grade and then it worked again:
// TODO this entire block had to be deleted to fix the issue
firebaseCrashlytics {
mappingFileUploadEnabled = false
}
This problem is common in Flutter 2.8
Delete Folder with all sub Folder of C:\Users\LENOVO\.gradle
Go File menu > Setting (Ctrl+Alt+S)
Go Appearance & Behaviour > System Setting > Android SDK > SDK Tool Tab
and then uncheck Android SDK Build-Tool press OK Button
3)Run Project (Shift+F10) in Andriod Studio it will Download all required files from the internet and your issue resolve
After if the issue is Not resolved then Second Step is:
Go > android\app\build.gradle in your project
Please Add > minSdkVersion 19 or 20
// Remove it because, 16 is by default minSdkVersion in flutter 2.8
//minSdkVersion flutter.minSdkVersion
add multiDexEnabled true if file size increase from limits
I added debug under buildTypes in the gradle file and missed a comma after "API_URL":
not working:
buildTypes {
...
debug {
buildConfigField "String", "API_URL" "\"http://myapi.com/\""
}
}
working:
buildTypes {
...
debug {
buildConfigField "String", "API_URL", "\"http://myapi.com/\""
}
}
good luck!
For me, the problem was in this block
defaultConfig {
applicationId "abc"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 12.1 **-> 13**
versionName "3"
}
The 'versionCode' mustn't be a decimal number
I had a problem similar to #LalitFauzdar 's but with a different solution. A plugin that I'm using requires custom ProGuard rules for release builds, but adding a reference to the rules file in the app gradle file resulted in the error in question. Here is the offending line, commented-out:
buildTypes {
release {
signingConfig signingConfigs.release
// proguardFiles 'proguard-rules.pro'
}
}
I had this error when i added 2 product flavors to my build.gradle app module file with the following names:
productFlavors {
normal-sv1 {
...
}
normal-sv2 {
...
}
}
Found out that this error was because of the '-' int the middle of the flavors' names.
When i used '_' instead of '-', like below, the error was gone.
productFlavors {
normal_sv1 {
...
}
normal_sv2 {
...
}
}
I received this error while creating a new Jetpack Compose project. 'app' module's build.gradle was cracking up.
Removing packagingOptions did the trick for me ->
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
There is no general answer to this problem. There is just something wrong with the app/build.gradle.
In my case I defined a variable named versionCode which caused the error. Renaming it to e.g. versionCode_ fixed the problem.
Make sure you are using the kotlin android plugin instead of the kotlin jvm plugin.
apply plugin: 'kotlin-android' // NOT kotlin-jvm
I had a similar issue because I had added a trailing comma , in defaultConfig in android/app/build.gradle
Try to comment this in your app level build.gradle file
openOptions {
disable 'InvalidPackage'
}
Thanks for mentioning to just comment things and test, for me it was:
kapt {
useBuildCache = true
}
Removed it, everything was building again.
Happened after updating Kotlin version.
Old issue but worth noting you might need to follow the migration guide here if you see this issue:
https://developer.android.com/topic/libraries/view-binding/migration
For me, removing the line apply plugin: 'kotlin-android-extensions' and adding view binding as below resolved the issue:
buildFeatures {
viewBinding true
}
I got this problem after adding
kapt {
// etc
}
because I hadn't added:
apply plugin: 'kotlin-kapt'
I have an Android app which has a module dependency. This module itself has a jar library as a dependency that comes in two variants, each relative to a build variant of the main app. When I switch build variant in the main app, I managed to automatically select the module's build variant which picks the correct jar, but this is not reflected in the code, where the specific classes from the jar are not found in the build variant specific code.
Here's the related code from the build.gradle files of the main app and the dependency module:
main app - build.gradle
buildTypes {
type1 {initWith(debug)}
type2 {initWith(debug)}
}
productFlavors {
live{}
test{}
}
dependencies {
type1Compile project(path: ':module', configuration: 'one')
type2Compile project(path: ':module', configuration: 'two')
}
module - build.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
publishNonDefault true
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
one {initWith(release)}
two {initWith(release)}
}
}
dependencies {
oneCompile files('libs/versionOne/mylib.jar')
twoCompile files('libs/versionTwo/mylib.jar')
}
So, when I build testType1 variant, Android Studio automatically selects one variant, and with a clean build it all goes fine. But if I switch to testType2, although module's two variant is selected, the editor will highlight missing classes and methods.
How can I make gradle pick the right jar when I switch between the app's build variants?
Some considerations:
The module needs the library, since it uses a few classes that are common between the 2 versions.
I know this may look like bad project design, but it's an app that has been built by different people in different times, and I now have to develop it "as is".
After some tinkering, I found some clues. First of all, my two jars where the same name, in different folders. After renaming the jars to have also different names, gradle manages to pick the correct one after the build variant switch, provided that an additional "Sync project with gradle files" is done. So now it's not immediate, but eventually it's working.
I'm having trouble debugging C++ files of my library module.
Is this possible in general?
The debugging works fine if the application project contains the c++ code.
But I want to move the C++ Code to a library module.
The Error Message while starting the session:
Now Launching Native Debug Session
Attention! No symbol directories found - please check your native debug configuration
gradle file of my lib:
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
arguments "-DANDROID_PLATFORM_LEVEL=${11}",
'-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:24.2.0'
}
In the run configuration the debugger is set to auto
Additions:
Im using:
Gradle : 2.2.3
Android Studio : 2.2.3
in the LLLB Console, i checked the breakpoint List with:
breakpoint list -v
all my checkpoints are listed there.
Not Working Breakpoint
1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0
..thats all
Working Breakpoint
1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0
1.1:
module = C:\android-dev\...\test.so
compile unit = gl_code.cpp
function = testFunc(..)
location = C:\android-dev\...\test.cpp:16
address = 0x0000007f871d068c
resolved = true
hit count = 1
The reason seems to be, that a release version of the lib is created,
which does not support debugging, even if the app is built with debug options.
Solution:
To solve this issue, do the following workaround. It ensures that a debug version is built.
In your apps build.gradle change:
compile project(':nativelib')
to
compile project(path: ':nativelib' , configuration: 'debug')
In the libs build.gradle add:
android {
publishNonDefault true //this line
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
...
}
...
}
Updates:
See the google issue for updates:
https://code.google.com/p/android/issues/detail?id=222276
I had the same error ("Attention! No symbol directories found - please check your native debug configuration."). My solution was (Android Studio 3.2):
Run → Edit Configuration → "Debugger" tab → add your working path to Symbol Directories.
I had the similar issue with my own libraries some months ago because I thought that if I added the -g (gcc) flag it would generate the debug symbols, as the desktop (linux, unix kernel) apps.
But, actually it does not work to generate debug symbols.
I see that you use Cmake as a external build tool and clang compiler.
So in my case I configure my cmake script with gcc but out of gradle scripting, but I think it will be the same, I add -mapcs-frame in the CMAKE_CXX_FLAGS.
externalNativeBuild {
cmake {
arguments "-DANDROID_PLATFORM_LEVEL=${11}",
'-DANDROID_TOOLCHAIN=gcc',
'-DANDROID_STL=gnustl_static',
'DCMAKE_CXX_FLAGS=-mapcs-frame'
}
}
I know that if you use clang compile may be this flag could not work. But my idea was to share my experience with android native debugging.
I Hope this clues could help you.
Cheers.
Unai.
In my case, it was because of co-worker who changed the visibility of symbols.
set(CMAKE_CXX_FLAGS -fvisibility=hidden)
After changing the above code to be applied only in release build, debugger(including breakpoints) works fine.
Getting started with the new android studio it seems very flexible but that usually brings a steep learning curve. Hoping to get some help with that here.
I've built an app and deployed it with this build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "me.test.simpleProject
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
signingConfigs {
release {
storeFile file("../my.keystore.jks")
storePassword System.getenv("and_ks_pw")
keyAlias System.getenv("and_ky_alias")
keyPassword System.getenv("and_k_pw")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(":Library:lib_my_lib_a")
compile project(":Library:lib_my_lib_b")
compile project(":Library:lib_my_lib_c")
}
This works pretty well and once I learn the syntax it'll be much easier to use than the previous system.
Now my question.
I would like to basically add a few product flavors.
I currently use google analytics to track clicks, usage stats, simple things like that.
In the past [before android studio] typically distribute my apps in a free/ paid version.
I would like to create say build flavors for:
google play free
google play paid
amazon free
amazon paid
The code for these apps should be mostly identical but they cannot be since, for example adding links to google play in your amazon apps gets you in a bit of trouble over there. So I will need to have unique classes across the build flavors.
I was reading some docs and watching google talks about setting up the build flavors but I am a bit confused.
Can someone help me define the folder structure for this project?
current application structure
test/
.gradle/
.idea/
app/
app/build
app/libs <-- empty
app/src
app/.gitignore
app/app.iml
app/build.gradle
app/proguard-rules.pro
build/
gradle/
Library/lib_a
Library/lib_b
Library/lib_c
.gitignore
build.gradle
gradle.properties
gradlew
gradlew.bat
local.properties
settings.gradle
test.iml
Can I place the new folders anywhere and how do I link them up with grade to properly build the variants?
The first thing you should do, is add these flavors to your gradle script, inside the android section:
productFlavors {
googleFree {
applicationId = "com.your.app.gfree"
}
googlePaid {
applicationId = "com.your.app.gpaid"
}
amazonFree {
applicationId = "com.your.app.afree"
}
amazonPaid {
applicationId = "com.your.app.apaid"
}
}
Note that you can define different package names for your app if needed, as well as some additional properties. Full details: Gradle Plugin - Build Variants
At this point you will have three different concepts in your app now:
Build types: Debug and Release
Product flavors: googleFree, googlePaid, amazonFree and amazonPaid
Build variants: Combination of build types and flavors
googleFreeDebug
googleFreeRelease
googlePaidDebug
googlePaidRelease
amazonFreeDebug
amazonFreeRelease
amazonPaidDebug
amazonPaidRelease
Flavor Specific resources:
For defining resources, you should have:
app
src
main
java
res
googlePaid
java
res
googleFree
java
res
amazonPaid
java
res
amazonFree
java
res
With that structure in place, you can place all your shared stuff under main, while the flavor specific stuff would live on each flavor's folder. Then, when building a specific variant of your app, android and gradle will resolve the right resources for you. If you are interested in more details, see Resource Merging.
Once the flavors have been added to your build.gradle file, if you sync your project, Android Studio will be able to pick your build variants and you may select these from the IDE:
To use flavors in your app you should have a structure like this:
app
src
flavor1
java
res
flavor2
java
res
main
java
res
You have to define the flavors in the build.gradle:
productFlavors {
flavor1 {
//
}
flavor2 {
//
}
}
Then you can have different dependencies using:
dependencies {
releaseCompile
debugCompile
flavor1Compile
flavor1DegubCompile
}
For example:
dependencies {
freeCompile 'com.google.android.gms:play-services:7.5.0'
}
Problem: I want two product flavors, a FREE version with ads and a PRO version without ads.
Ads require Google Play with a min SDK of 9 so I set that for FREE but I want my pro version to have a min SDK of 8.
The build of the FREE version works but the build of PRO does not.
I am using (stable) Android Studio 1.1.0.
I setup a new project with a blank activity (Hello World example).
I then modified the build.gradle file (below) to include the two flavors and FREE-specific compile dependency and then modified the file structure to move the activity's java and layout xml files into the flavor structures. Thus, the project has the following file structure:
app\src\
free\
java\com\sample\adexample\MainActivity.java - This is Hello World.
res\layout\activity_main.xml - This is the Hello World layout.
res\values\strings.xml - Unique Hello World string for free version.
res\AndroidManifest.xml - This is a copy of the manifest in main.
main\
java\com\sample\adexample\ - empty
res\layout\ - empty
res\AndroidManifest.xml - This is the Hello World manifest.
pro\
java\com\sample\adexample\MainActivity.java - This is Hello World.
res\layout\activity_main.xml - This is the Hello World layout.
res\values\strings.xml - Unique Hello World string for free version.
res\AndroidManifest.xml - This is a copy of the manifest in main.
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.sample.adexample"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
pro {
applicationId "com.sample.adexample.pro"
minSdkVersion 8
versionName "1.0-Pro"
}
free {
applicationId "com.sample.adexample.free"
minSdkVersion 9
versionName "1.0-Free"
dependencies {
compile 'com.google.android.gms:play-services:6.+'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Building the freeDebug flavor works fine.
But I get the following error when building proDebug:
:app:processProDebugManifest
C:\Users\Jeff\AndroidStudioProjects\AdExample\app\src\main\AndroidManifest.xml:0:0 Error:
uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library C:\Users\Jeff\AndroidStudioProjects\AdExample\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\6.5.87\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms" to force usage
Is there a way to accomplish the requirements?
Thanks for your time.
Remove the dependencies closure from free. Move that compile 'com.google.android.gms:play-services:6.+' into your existing dependencies closure and make it be freeCompile rather than compile.
A prefix on the compile statement is how you make dependencies be tied to build variants rather than be used all the time the way compile is. So, a debugCompile would declare a dependency for only the debug build type, and freeCompile would declare a dependency for only the free product flavor.
AFAIK, this should work for multiple flavor dimensions, so if you had a dependency that was only relevant for the bird flavor (on one dimension) and the free flavor (on another dimension), you could use freeBirdCompile 'com.skynyrd.lynyrd:raised-lighter:1.0.0' to pull that in.