Android Studio无法启动应用

时间:2015-01-29 18:03:49

标签: android android-studio crash

我从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'.
....

那么这里发生了什么。代码是完全正确的!

1 个答案:

答案 0 :(得分:0)

确保您已通过SDK-Manager下载了最新的附加内容以及Android 5.0 SDK。

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

android {
    //...
    compileSdkVersion 21

    defaultConfig {
        targetSdkVersion 21
    }
    //...
}