问题描述
我使用android studio 3构建了一个应用程序,但是当我要发布它时,市场人士说:您的应用程序必须具有有效的targetSdkVersion集.要解决此问题,您需要编辑AndroidManifest.xml文件,然后再次上传.apk文件."我以为proguard会出现此问题,因此请将-keep AndroidManifest.xml
添加到规则中.但这不能解决我的问题.请问你能帮帮我吗?我忘了说我的清单中没有targetSdkVersion.我手动添加了它,但没有解决我的问题.我的清单:
I build an app using android studio 3, but when I want to publish it, market said "Your application must have a valid targetSdkVersion set. To solve this problem, you need to edit your AndroidManifest.xml file and upload again the .apk file."I thought proguard make this problem so add -keep AndroidManifest.xml
to rules. But it doesn't resolve my problem.could you help me please?I forgot to say I didn't have targetSdkVersion in my manifest. I added it manually but didn't resolve my problem.my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ir.farshidete.breathefree">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /><!--optional-->
<uses-permission android:name="android.permission.VIBRATE" /><!--optional-->
<application
android:name=".G"
android:allowBackup="true"
android:icon="@drawable/icon128"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
<activity android:name=".Main_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Relaxing_Activity" />
<activity android:name=".Setting_Activity" />
<activity android:name=".Info_Activity" />
<activity android:name=".Absorption_Activity" />
<activity android:name=".Capacity_Activity" />
<activity android:name=".Control_Activity" />
<activity android:name=".Program_Activity" />
<activity android:name=".Contact_Activity" />
<activity android:name="ir.tapsell.sdk.TapsellAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize" >
</activity>
</application>
</manifest>
我的礼物:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ir.farshidete.breathefree"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
// Uses new built-in shrinker http://tools.android.com/tech-docs/new-build-system/built-in-shrinker
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguardTest-rules.pro'
}
release {
minifyEnabled false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguardTest-rules.pro'
}
}
}
dependencies {
api(name:'tapsell-sdk-android', ext:'aar')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
推荐答案
最后,我通过以下方法解决了它:删除:
Finally I solved it by:removing:
minSdkVersion 15
targetSdkVersion 28
从gradle.并添加:
from gradle.and adding :
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="26" />
体现!似乎slideme.org不是最新的...
to manifest!It seems slideme.org isn't up to date...
这篇关于为什么AndroidManifest.xml具有无效的targetSdkVersion?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!