Edy*_*per 53 android themes warnings styles manifest
我在尝试在最新的Android SDK Package 4.2上测试主题时收到警告.
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.themetest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme" >
<activity
android:name="com.example.themetest.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
不针对最新版本的Android; 兼容模式适用.考虑测试和更新此版本.有关详细信息,请参阅android.os.Build.VERSION_CODES javadoc.AndroidManifest.xml/ThemeTest第7行Android Lint问题
我正在使用一个名为"AppBaseTheme"的自定义主题.我的问题是究竟是什么咨询android.os.Build.VERSION_CODES javadoc..我怎么能解决这个问题?
Rag*_*ood 98
它说这是因为targetSdkVersion="16".API 16是Jellybean 4.1和4.1.1,而Jellybean 4.2是API 17.
尝试使用:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Run Code Online (Sandbox Code Playgroud)
另外,请记住这是一个Lint警告.存在这些警告是为了帮助您更好地编写代码并使其易于维护,同时兼容最新的Android更改.忽略这一点不会导致任何直接问题.
编辑:使用Android 4.3,最新的SDK版本现在是18,所以你应该使用:
...
android:targetSdkVersion="18" />
Run Code Online (Sandbox Code Playgroud)
编辑2:使用Android 4.4,最新的SDK版本现在是19,所以你应该使用:
...
android:targetSdkVersion="19" />
Run Code Online (Sandbox Code Playgroud)
编辑3:借助Android L,则必须使用下面的值,如所描述这里:
compileSdkVersion="android-L"
minSdkVersion="L"
targetSdkVersion="L"
Run Code Online (Sandbox Code Playgroud)
编辑4:使用Android L'公开发布时,您必须使用21代替:
...
android:targetSdkVersion="21" />
Run Code Online (Sandbox Code Playgroud)
20用于4.4W,或用于Android Wear.
编辑5:使用Android M的公开发布,你必须使用23代替:
...
android:targetSdkVersion="23" />
Run Code Online (Sandbox Code Playgroud)
将来请查阅官方Android文档,以便及时了解最新的Android API级别.
小智 7
您不应该使用,android:maxSdkVersion="17"因为这意味着如果有人使用您的应用程序将其Android操作系统更新为大于17的版本,您的应用程序将被删除.
| 归档时间: |
|
| 查看次数: |
66686 次 |
| 最近记录: |