gpt4 book ai didi

android - 错误 : "Version code not found in manifest."

转载 作者:行者123 更新时间:2023-12-05 00:13:47 28 4
gpt4 key购买 nike

我正在尝试构建已签名的应用程序包,因此发布。我所做的只是更新操作系统版本和一些图形。该应用程序在 ADK 上运行得很好。构建签名的 apk 时,我收到此错误消息:

"Version code not found in manifest."

这是错误日志:

"Caused by: com.android.ide.common.workers.WorkerExecutorException:
1 exception was raised by workers: com.android.tools.build.bundletool.exceptions.manifest.ManifestVersionException$VersionCodeMissingException: Version code not found in manifest."

感谢任何能帮我解决这个小问题的人。我在这里搜索,但找不到好的解决方案。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sevillasoundservices.warningshot">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ShotgunSensing"
android:label="@string/title_activity_shotgun"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RifleSensing"
android:label="@string/title_activity_rifle"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PistolSensing"
android:label="@string/title_activity_pistol"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>


Gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.sevillasoundservices.warningshot"
minSdkVersion 24
targetSdkVersion 28
versionName '1.0.2'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.13-beta-3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
}

我希望这里有人能告诉我缺少了什么。我希望简单地在 list 文件中插入一些代码来解决这个问题,但是,其他编码器 list 的所有其他示例都没有在任何地方显示任何版本。

最佳答案

versionCode 添加到您的 gradle。像下面这样的东西......

   defaultConfig {
applicationId "com.sevillasoundservices.warningshot"
minSdkVersion 24
targetSdkVersion 28
versionName '1.0.2'
versionCode 3
}

versionCode 是一个增量整数,用于确定哪个版本高于另一个。我认为这只对签名的 APK 强制执行,这就是为什么您之前没有看到错误的原因。

更多信息可以在 Android Developer Guides 中找到

关于android - 错误 : "Version code not found in manifest.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57470110/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com