使用android studio中遇到的常见问题及解决方法

软件环境:android studio

记录一下自己使用android studio过程中遇到的问题和解决方案


Question 1: "cannot resolve symbol R"

解决方法:Build -> Clean Project


Question 2:"NumberFormatException: Invalid revision: 24.0.0-alpha1"

解决方法:

找到Android sdk安装目录

sdk/extras/android/m2repository/com/android/support/appcompat-v7文件夹中删除 24.0.0-alpha1 文件夹

并在sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml文件中删24.0.0-alpha1这一行


Question 3:“Cannot reload AVD list: cvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.Error parsing D:\sdkforas\android-sdk-windows\system-images\android-22\android-wear\armeabi-v7a\devices.xmlcvc-enumeration-valid: Value '280dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a value from the enumeration.Error parsing D:\sdkforas\android-sdk-windows\system-images\android-22\android-wear\x86\devices.xml​”

解决方法:

找到Android sdk安装目录

用/sdk/tools/lib/devices.xml

替换   system-images\android-22\android-wear\x86\devices.xml

再替换   system-images\android-22\android-wear\armeabi-v7a\devices.xml


Question 4:"can not resolve maketext() method of Toast"

Toast.makeText(this,"start" ,Toast.LENGTH_LONG).show();

error:    java: no suitable method found for makeText(idtech.ESDN.ShapeData,java.lang.CharSequence,int) method android.widget.Toast.makeText(android.content.Context,int,int) is not applicable (actual argument idtech.ESDN.ShapeData cannot be converted to android.content.Context by method invocation conversion) method android.widget.Toast.makeText(android.content.Context,java.lang.CharSequence,int) is not applicable (actual argument idtech.ESDN.ShapeData cannot be converted to android.content.Context by method invocation conversion)

解决方法:

改为: Toast.makeText(getApplicationContext(),"start" ,Toast.LENGTH_LONG).show();



你可能感兴趣的:(Android)