【发布时间】:2019-09-28 15:42:10
【问题描述】:
我正在尝试将我的第一个应用上传到 Slideme,但遇到以下错误: 您的应用程序必须具有有效的 targetSdkVersion 集。要解决这个问题,您需要编辑您的 AndroidManifest.xml 文件并重新上传 .apk 文件。
所以我将 targetSdkVersion 添加到我的清单文件并将其从我的 gradle 文件中删除,但仍然没有运气。我还尝试了仍然在 gradle 文件中设置的 targetSdkVersion 但也没有运气。我玩了很多,但我一直收到同样的错误。我已经多次重置 android studio,并且尝试关闭并重新打开 slideme 上传网页,但没有任何变化。
这是我的 manifest.xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.doublerun">
<uses-sdk android:targetSdkVersion="29" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".GameActivity"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是我的 Gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.cards.doublerun"
minSdkVersion 15
//targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
我看过这个问题:Why does AndroidManifest.xml have invalid targetSdkVersion? 这个问题:Valid sdkVersion for slideme.org 但是两者中提供的建议对我不起作用。任何帮助将不胜感激。
【问题讨论】:
-
应用内有多个模块吗?他们可能有问题
-
请原谅我的无知,但我不这么认为...不过我确实有两个活动。这是一个超级基本的应用程序。但是我应该注意,当我将目标值更改为 15 时,我让它工作了,但我无法让它在 targetSdkValue 为 29 的情况下工作。有什么想法吗?
标签: java android build.gradle android-manifest