I cannot compile and android app in android studio by the ndk - android

I need to compile a project but i need solve any errors. My Android Grandle Plugin version is 3.1.1 and Grandle Version is 4.4
Build file '/home/javier/Descargas/VisitaOficialArriboOfflinev2/VisitaOficialArriboOffline/app/build.gradle' line: 79A problem occurred evaluating project ':app'.> Could not find method ndkversion() forarguments [21.3.6528147] on object of type com.android.build.gradle.AppExtension.
this is my build:gardle:app the line that have the error is ndkversion '21.3.6528147'
//apply plugin: 'com.android.feature' for instant app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk{
abiFilters "x86", "armeabi-v7a", "armeabi-v8a", "x86_64"
}
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
//Remove minifyEnabled true from release if you are getting error while creating final releasing api.
minifyEnabled false
debuggable false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
//Remove minifyEnabled true from debug if you are getting error while compiling the app. As this time its running debug part.
minifyEnabled false
debuggable true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path file ('CMakeLists.txt')
}
}
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
//....
}
//The line with error
ndkversion '21.3.6528147' }
The path route of my ndk is "ndk.dir=/home/javier/Android/Sdk/ndk"
Thanks for your help

Edit the local.properties file, and add the following line to it, under sdk.dir -
ndk.dir=/path/to/your/Android/Sdk/ndk/21.3.6528147
and then delete or comment out the ndkVersion '21.3.6528147' line from the gradle file.
That should solve the issue.
If you now get the CMake was unable to find a build program corresponding to "Ninja" error, uninstall cmake 3.10 and install cmake 3.6 instead.
Now everything should work fine, but just in case it still insists on the wrong cmake for some reason, you can also the following line to your local.properties file:
cmake.dir=/path/to/your/Android/sdk/cmake/3.6.4111459

Related

Support library v4 aar in doesn't convert automatically to androidX in unity project

I have an AR project in unity and i just added Mapbox to the project which immediately caused this error:
What went wrong:
Could not determine the dependencies of task ':launcher:lintVitalRelease'.
Could not resolve all artifacts for configuration ':launcher:debugRuntimeClasspath'.
Failed to transform artifact 'support-v4-25.1.0.aar (:support-v4-25.1.0:)' to match attributes {artifactType=jar}.
>>>> Execution failed for JetifyTransform: C:\Users\EFGH\Documents\GitHub\national-trail\NationalTrail\Temp\gradleOut\unityLibrary\libs\support-v4-25.1.0.aar.
>>>>> Failed to transform 'C:\Users\EFGH\Documents\GitHub\national-trail\NationalTrail\Temp\gradleOut\unityLibrary\libs\support-v4-25.1.0.aar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
I have googled this error in so many variations but found nothing relevant, i have deleted the Library folder and rebuilt it but the error persists, i have added android.useAndroidX=true and android.enableJetifier=true in my gradle.properties file but it didn't do anything.
Here is my mainTemplate.gradle:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
And here is my launcherTemplate.gradle: ( i have no idea what the ** SOMEWORD ** means..)
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
apply plugin: 'com.android.application'
dependencies {
implementation project(':unityLibrary')
}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**
lintOptions {
abortOnError false
}
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
}**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
I figuered out that some .aar files are being moved from the imported Mapbox asset to a Temp folder, and more specifically from Assets\Mapbox\Core\Plugins\Android into Temp\gradleOut\unityLibrary\libs so it has to be related to the problem somehow.. as shown in the following figure:
I am really stuck on the line Libraries using reflection such as annotation processors need to be updated manually to add support for androidx since this is the only partially-useful line in the error, but i have no idea what it mean to UPDATE the library manually..? update what exactly? and from where? to where? how?

Could not get unknown property 'experimentalProperties' for extension 'android' | Android Jetpack Macrobenchmark

I am following macrobenchmark setup configurations from -
https://developer.android.com/studio/profile/macrobenchmark#configuration
In following code in my macrobenchmark's build.gradle
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
targetProjectPath = ":app" // Note that your module name may be different
experimentalProperties["android.experimental.self-instrumenting"] = true
buildTypes {
release {
debuggable = true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
following build error is thrown while gradle sync:
A problem occurred evaluating project ':macrobenchmark'.
> Could not get unknown property 'experimentalProperties' for extension 'android' of type com.android.build.gradle.TestExtension.
I'm new to android, any help is appreciated, thanks in advance.
Fixed the error, via following -
Updated Android Studio to Arctic Fox Beta Version
Updated gradle version in project build.gradle to 7.0 beta4
Found solution through documentation of benchmark samples repository provided by google and comparing gradle files.
Due other dependencies I had to update to version 7.1.0-alpha02 of gradle plugin in project build.gradle file.
And this property got recognized.

How to resolve this issue Error while executing c:\Users\user\...\cmake.exe with arguments {-HF:\My Project\app\sr.......-DANDROID_TOOLCHAIN=clang}

I am not so much familiar with Cmake of the android studio. Recently I decided to use it for the native interface. Every time I build the project from build tool, I am getting the aforesaid error in gradle sync message.
My CMakeLists.txt file
cmake_minimum_required(VERSION 3.4.1)
add_library(native-lib
SHARED
src/main/cpp/native-lib.cpp)
My build.gradle (app level)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId="com.example.user.MyProject"
minSdkVersion 17
targetSdkVersion 24
multiDexEnabled true
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags '-frtti'
arguments '-DANDROID_TOOLCHAIN=clang'
abiFilters 'armeabi-v7a'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// proguardFiles.add(file("proguard-rules.txt"))
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
}
dependencies {
What am I doing wrong here?? Any help will be appreciated.

Android JACK compiler error after upgrade to latest support library

--Android Studio 2.2.3 (Windows 10 64 bit)
--Build Tools version 25
--Android Gradle Plugin Version 2.2.3
After upgrade to latest support libraries (25.1.0 from 23.4.0) and change of compile version (25 from 23) I get this error:
Error:com.android.sched.util.config.PropertyIdException: Property 'jack.library.import' (in Options): element #7: The version of the library file '..\app\build\intermediates\transforms\preJackPackagedLibraries\debug\jars\8000\1f\classes-1b6639e8217419d056942b0dacd1542739f1709f.jar' is not supported anymore. Library version: 3.2 - Current version: 3.3 - Minimum compatible version: 3.3
...
BUILD FAILED
Has anyone ever had this problem? In the mentioned .jar file I can find some AnimatedVectorDrawble related files. My app build.gradle
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "package"
minSdkVersion 14
targetSdkVersion 25
versionCode 111
versionName "1.1.1"
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
jackOptions.enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
maxProcessCount 4
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".dev"
versionNameSuffix "-DEV"
ext.enableCrashlytics = false
}
}
}
Based on the error message, it appears that Jack-enabled builds do not handle all cases where you update Gradle build settings. Jack keeps a cache of pre-compiled stuff (preJackPackagedLibraries), and something that you changed caused Jack to not like that pre-compiled material. Ideally, the build system would detect this case and simply re-compile it, but apparently it does not.
Cleaning the project (Build > Clean Project) hopefully clears up this problem in all cases.

buildTypes not working build.gradle Android Studio

I am new to Android studio and I need to add:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
in my build.gradle Android Studio, but getting error:
Gradle DSL method not found:'buildTypes()'
Try to configure buildTypes from "File-> Project Structure" and select your module, you can easily configure everything on the right side panel.
are you sure that your build file is set up correctly?
The buildTypes have to be in the android closure. It should look something like this
note: this is just a example you can't just copy and paste this
android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.your.package"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Hope this is of use for you

Categories

Resources