简体   繁体   English

在 Android 手机上运行应用程序时出错

[英]Error Running the Application on Android Mobile

I was working on a small flutter project suddenly I couldn't run the app to any android mobile.我正在做一个小的 flutter 项目,突然我无法在任何 android 手机上运行该应用程序。 (on Web it's running Perfectly). (在 Web 上运行完美)。 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:这是我的 Gradle.build 文件:

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
}

maybe或许

flutter doctor -v

usefull有用的

I had the issue Android SDK file not found: C:\Users\Admin\AppData\Local\Android\Sdk\build-tools\31.0.0\aapt.我有问题 Android SDK 找不到文件: 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"SDK Manager , go 到SDK tools ,勾选“Show the various packages”复选框,取消勾选“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)现在在Android SDK Build-tools 31下,安装31.0.0并应用Android SDK Command-line tools (最新)下,安装Android SDK Command-line tools (过时)

This worked for me!这对我有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM