I was working on a small flutter project suddenly I couldn't run the app to any android mobile. (on Web it's running Perfectly). It Shows this Error:
Could not locate aapt. Please ensure you have the Android buildtools installed.
No application found for TargetPlatform.android_x86.
Is your project missing an android\app\src\main\AndroidManifest.xml?
Consider running "flutter create ." to create one.
How can I solve this Error Thanks A Lot
This is my Gradle.build file:
buildscript {
ext.kotlin_version = '1.5.21'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
CodePudding user response:
maybe
flutter doctor -v
usefull
CodePudding user response:
I had the issue Android SDK file not found: C:\Users\Admin\AppData\Local\Android\Sdk\build-tools\31.0.0\aapt.
I had already tried other solutions but this worked for me . In SDK Manager , go to SDK tools , and check the checkbox "Show the various packages" and uncheck "Hide obsolete packages"
Now under Android SDK Build-tools 31 , install 31.0.0 and apply Under Android SDK Command-line tools (latest), install Android SDK Command-line tools (obsolete)
This worked for me!