简体   繁体   中英

Android Studio won't launch app

I switched from eclipse to android studio. I created a blank app for testing purpose and I was able to launch in properly. However, after having added some simple code I'm no longer to start. The error messages I get are:

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

or

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

So what is happening here. The code is defintely correct!

Make sure that you've downloaded the latest extras as well as the Android 5.0 SDK via the SDK-Manager .

And set your compileSdkVersion to 21 in your build.gradle file. You also probably want to change your targetSdkVersion to 21.

android {
    //...
    compileSdkVersion 21

    defaultConfig {
        targetSdkVersion 21
    }
    //...
}

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