How can I make arm64-v8a show up in Build Variant section?
I'm using the following setup on macOS:
Android Studio 3.4.1
Gradle Version 3.3
android-ndk-r15c
compileSdkVersion = 25
put this code in build gradle
splits {
abi {
enable true
reset()
include "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
}
}
Documentation
Related
Flutter was working perfectly on previous device. I have changed my laptop, after all the setup I am getting this error I am unable to understand this error.
please explain what is this error for.
Solution for this error
I am just running very basic application.
app gradle
> def localProperties = new Properties() def localPropertiesFile =
> rootProject.file('local.properties') if (localPropertiesFile.exists())
> {
> localPropertiesFile.withReader('UTF-8') { reader ->
> localProperties.load(reader)
> } }
>
> def flutterRoot = localProperties.getProperty('flutter.sdk') if
> (flutterRoot == null) {
> throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
>
> def flutterVersionCode =
> localProperties.getProperty('flutter.versionCode') if
> (flutterVersionCode == null) {
> flutterVersionCode = '1' }
>
> def flutterVersionName =
> localProperties.getProperty('flutter.versionName') if
> (flutterVersionName == null) {
> flutterVersionName = '1.0' }
>
> apply plugin: 'com.android.application' apply plugin: 'kotlin-android'
> apply from:
> "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
>
> android {
> compileSdkVersion 29
>
> sourceSets {
> main.java.srcDirs += 'src/main/kotlin'
> }
>
> lintOptions {
> disable 'InvalidPackage'
> }
>
> defaultConfig {
> // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
> applicationId "com.example.flutter_app"
> minSdkVersion 16
> targetSdkVersion 29
> versionCode flutterVersionCode.toInteger()
> versionName flutterVersionName
> }
>
> buildTypes {
> release {
> // TODO: Add your own signing config for the release build.
> // Signing with the debug keys for now, so `flutter run --release` works.
> signingConfig signingConfigs.debug
> }
> } }
>
> flutter {
> source '../..' }
>
> dependencies {
> implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
android gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Logcat:
Please configure Android SDK
Terminal report
C:\Users\HP\StudioProjects\flutter_app>flutter run
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 29 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 29 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\HP\AppData\Local\Android\sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 2.5s
Exception: Gradle task assembleDebug failed with exit code 1
Flutter doctor - V
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.1082], locale en-US)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d302e2 (4 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\HP\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.49.2)
• VS Code at C:\Users\HP\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
! Doctor found issues in 1 category.
Run this command to accept all license from Android.
flutter doctor --android-licenses and download sdk manager and build tools from Android studio
Apparently, what you can do is simply head to your Android SDK directory
and
cd "/tools/bin"
and run the following command
sdkmanager --licenses
and let the terminal do its job !
Here is the main problem
Failed to install the following Android SDK packages as some licenses have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
As the error suggests, first accept all licenses by running the following command
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3
After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac
finally, download the missing Android SDK platform 29 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-29 if you are on mac or C:\Android\Sdk\platforms\android-29 if you are on windows
Run your project (flutter run) and enjoy
I am having an issue with building new projects on android studio. I keep on getting the error:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
AAPT: error: failed writing to 'D:\Libraries\Documents\AndroidStudio\SocketTest\app\build\intermediates\runtime_symbol_list\debug\R.txt': The data is invalid. (13).
Here is my project build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.sockettest"
minSdkVersion 26
targetSdkVersion 28
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 = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
This problem only occurs on new projects I try to build and isn't an issue on older ones.
I have read through R.txt': The data is invalid. (13) which leads to Long package name build error in Android Studio which still does not solve the problem.
I only encounter this issue while using windows 10 (update 1909), and not while using android studio on ubuntu. I am running android studio version 3.6.2
I know this is a year late but could it be an antivirus blocking it? This is what Avast came up with:
In case someone new to android studios like me does not know how to downgrade Gradle and plugin, here's how (windows):
Select File>Project Structure.
Type in (3.6.3) the Android Gradle Plugin Version.
Type/select (6.0) from dropdown menu the Gradle Version.
Hit OK to Save.
Android Studios will download and set up the new Gradle for the current project. This resolved the data is invalid error for me.
Was getting the same error. I realized it had something to do with the Gradle version I was running, even though I usually stick to the stable channel of releases. I ended up downgrading to plugin version: 3.6.3 & Gradle version 6.0. I had previously been on plugin version 4.0.0 & Gradle version 6.1.1.
I don't know if this was for sure the same issue, this was happening to any projects on my Win10 PC (ver 2004) that were running that Gradle version.
Please follow this :
Uninstall your System(Windows OS)anti virus and most probably it will work.
I already solved by adding this in my dependency
implementation 'com.android.support:design:28.+'
I had a similar issue trying to build an ionic capacitor app with android studio. I later discovered that one of the directories' names in the project's path has space in the name.
I just copied the project into another directory to form a path that has no space and recompiled the project and the error vernished.
I use IntelliJ IDEA for creating #Flutter projects and I have the Android Studio for installation purposes of Flutter onto my machine. The problem arose when I upgraded the Android Studio from 3.1.4 to 3.2.1. Moreover, after this upgrade, I'm no longer able to create any project in both IDEs.
The error message in IntelliJ
The error message in Android Studio
P.S. Those are the default programs of both IDEs namely, IntelliJ and Android Studio.
any newly-created project brings up this error; however, previously-created projects work perfectly fine.
My machine has 64-bit OS, x64-based Processor
IntelliJ
IntelliJ IDEA 2018.3.3 (Community Edition)
Build #IC-183.5153.38, built on January 9, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Android Studio
Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
project's build.gradle file:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
the individual module build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.nonna.myapplication"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
I have checked those questions but unfortunately, the error wasn't fixed.
Build errors after Android Studio 3.2.1 upgrade
Could not find com.android.tools.build:aapt2:3.2.0
This issue got solved and now the IDE is working like a charm.
As it was seen from the provided screenshots there was an error in the Android Gradle plugin, so to solve this issue follow the numbered steps in the newly provided screenshots below.
(Part 1) Solving gradle issue due to upgrading Android Studio to 3.2.1
Step 0: From the left panel in your IDE, choose the android
[name_of_project] folder
Step 1: look for the build.gradle file then double click it to
start editing it
Step 2: change exactly the line that states
classpath
'com.android.tools.build:gradle:3.2.1' to the current version of
your Android Studio, in other terms, classpath
'com.android.tools.build:gradle:3.3.0' in my case.
(Part 2) Solving gradle issue due to upgrading Android Studio to 3.2.1
Step 3: After finishing from Steps 1 & 2, go to the gradle folder
Step 4: Double click on the wrapper subfolder
Step 5: Click the gradle-wrapper.properties file to start editing
it
Step 6: make sure that your gradle version is compatible with your
current Android Studio
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
The Android Gradle plugin 3.3.0 requires the Gradle version of 4.10.1 and newer.
Disclaimer: you need to do these steps whenever you create a new project on whatever IDE you use namely, Android Studio, IntelliJ IDEA, and VS Code.
In Android Studio 3.2.1 I had two build variants visible for my native library; Release and Debug. In 3.3 I get a combination of these and all ABIs. I don't want to build multiple APKs for all the ABIs.
The relevant parts of the native library project:
apply plugin: 'com.android.library'
android {
defaultConfig {
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your APK.
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
buildTypes {
release {
}
debug {
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
sourceSets {
main {
java.srcDir generatedSrcDir
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
}
Build warnings
Maybe unrelated, but I observed this warning in the Build log (actually twice in a row):
WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by
'android.injected.build.abi' gradle flag contained 'ARMEABI' not
targeted by this project.
How do I get back to the old behavior?
Apparently this is an intentional change: see this issue.
According to the linked ticket, this is only "cosmetic"(ie a UI change); a full/fat .apk is still built.
I'm building an app with an NDK library using Android Studio 1.5.1 and the Gradle experimental plugin 0.4.0.
Even though the Gradle config is set as such (with minSdkVersion.apiLevel = 18), it seems like the NDK library is still compiled for android-21:
compileOptions.with {
sourceCompatibility=JavaVersion.VERSION_1_7
targetCompatibility=JavaVersion.VERSION_1_7
}
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "net.pol_online.hyper"
minSdkVersion.apiLevel = 18 // Android 4.3 Jelly Bean
targetSdkVersion.apiLevel = 23 // Android 6.0 Marshmallow
}
}
Is it because APP_PLATFORM is not automatically set by the Gradle NDK support based on the min SDK version? If so how do you fix this?
You can set this:
android.ndk {
platformVersion = "19"
}
See https://stackoverflow.com/a/33982735/3115956 for details on this. (In practice, I think your library is built targeting android-23, which has the same effect as targeting android-21 - compileSdkVersion is the one that affects it (for both the java and native code, unless the native one is overridden).