1.import project, SDK directory: Sdk\samples\android-21\legacy\apidemos,import The next step is OK.
2.error:error:the file name must end with. XML, renaming Add. xml
3.Run app, you may encounter 3 problems:
This issue requires importing the SUPPORTV4 package
New issues arise:
Error:execution failed for task ': App:processdebugmanifest '.
> Manifest merger failed:uses-sdk:minsdkversion 1 cannot be smaller than version 9 declared in library [Com.android.s UPPORT:SUPPORT-V4:25.1.0] D:\androidProject\ApiDemos\app\build\intermediates\exploded-aar\com.android.support\ Support-v4\25.1.0\androidmanifest.xml
Suggestion:use tools:overridelibrary= "android.support.v4" to force usage
The solution is to build.gradle (Module) add in mindSdkVersion :
defaultConfig { minSdkVersion 21 }
Exception at this time:
dependencies {
Compile ' com.android.support:support-v4:25.1.0 '
}
修改 support-v4 的版本号为 22.2.1即可。
异常:找不到FloatMath.sqrt(0.125f)
The FloatMath.sqrt(0.125f) method has been removed from the 6.0 SDK: All methods were removed from the public API in version 23.
Modified compileSdkVersion to 22 (originally 23), while modifying the SUPPORT-V4 version number to 22.2.1
4. Rerun after exception:
The references to these two classes require a system class, all of which are dropped on its contents
Run again, and you're running.
Android Studio Import Apidemo