繁体   English   中英

Android Studio无法启动应用

[英]Android Studio won't launch app

我从eclipse切换到android studio。 我创建了一个空白应用程序用于测试目的,并且能够正常启动。 但是,在添加了一些简单的代码之后,我不再开始了。 我收到的错误消息是:

Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.

要么

Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.

...

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/Tom/Java/Android/android_sdk_4.2/build-tools/19.1.0/aapt package -f --no-crunch -I /Users/Tom/Java/Android/android_sdk_4.2/platforms/android-17/android.jar -M /Users/Tom/Programming/ToyApp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/Tom/Programming/ToyApp/app/build/intermediates/res/debug -A /Users/Tom/Programming/ToyApp/app/build/intermediates/assets/debug -m -J /Users/Tom/Programming/ToyApp/app/build/generated/source/r/debug -F /Users/Tom/Programming/ToyApp/app/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package app.beziehungen -0 apk --output-text-symbols /Users/Tom/Programming/ToyApp/app/build/intermediates/symbols/debug
  Error Code:
    1
  Output:
    /Users/Tom/Programming/ToyApp/app/build/intermediates/res/debug/values-v21/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
    /Users/Tom/Programming/ToyApp/app/build/intermediates/res/debug/values-v21/values.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
    /Users/Tom/Programming/ToyApp/app/build/intermediates/res/debug/values-v21/values.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
    /Users/Tom/Programming/ToyApp/app/build/intermediates/res/debug/values-v21/values.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
....

那么这里发生了什么。 该代码绝对正确!

确保您已通过SDK-Manager下载了最新版本以及Android 5.0 SDK。

并在build.gradle文件compileSdkVersion设置为21。 您可能还想将targetSdkVersion更改为21。

android {
    //...
    compileSdkVersion 21

    defaultConfig {
        targetSdkVersion 21
    }
    //...
}

暂无
暂无

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

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