简体   繁体   中英

Why isn't my app running on an android emulator?

I'm creating a flutter app, and I'm trying to test it for Android. When I open up the emulator, it runs normally, but when I try to run my app, I get this error... Can anyone help solve? It runs perfectly in Xcode on my iPhone, but doesn't seem to run on Android...

Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... FAILURE: Build failed with an exception.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * What went wrong:
Running Gradle task 'assembleDebug'... Execution failed for task ':app:processDebugResources'.
Running Gradle task 'assembleDebug'... > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Running Gradle task 'assembleDebug'... > Android resource linking failed
Running Gradle task 'assembleDebug'... /Users/ragz/.gradle/caches/transforms-2/files-2.1/554200784d0157df45da8212b6e09519/play-services-ads-lite-19.7.0/AndroidManifest.xml:27:5-43:15: AAPT: error: unexpected element found in .
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * Try:
Running Gradle task 'assembleDebug'... 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.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... * Get more help at https://help.gradle.org
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... BUILD FAILED in 4m 29s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 305.2s
The build failed likely due to AndroidX incompatibilities in a plugin.
The tool is about to try using Jetifier to solve the incompatibility.
Building plugin flutter_tts...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 87.4s
*********************************************************
WARNING: This version of flutter_tts will break your Android build if it or its dependencies aren't compatible with AndroidX.
See  for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************

FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring root project 'flutter_tts'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/ragz/.pub-cache/hosted/pub.dartlang.org/flutter_tts-3.0.0/android/local.properties'.

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 1m 24s

Exception: The plugin flutter_tts could not be built due to the issue
above.

Check if your minSDKVersion 21 in build.gradle.

Here's my flutter doctor run (it seems like nothing is wrong to me, maybe there is? im not sure) -

[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2 20D64 darwin-x64, locale en-GB)
    • Flutter version 2.0.2 at /Users/ragz/flutter
    • Framework revision 8962f6dc68 (2 weeks ago), 2021-03-11 13:22:20 -0800
    • Engine revision 5d8bf811b3
    • Dart version 2.12.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ragz/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11 (API
      30) (emulator)
    • Chrome (web)                • chrome        • web-javascript • Google Chrome
      

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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