Issue
I am trying to build the signed app bundle, so publishing. All I did was update the OS versions and some graphics. The app runs on the ADKs just fine. When building the signed apk, I get this error message:
This is the error log:
"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."
Thanks for anyone that can help me sort this small issue out. I searched on here and could not find a good fix.
<?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>
The Gradle file:
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'
}
I am hoping someone here can tell me what is missing. I expect to simply insert some code on the manifest file to sort this out, however, all other examples of other coders manifests do not have any version showing anywhere.
Solution
Add the versionCode
to your gradle. Something like below...
defaultConfig {
applicationId "com.sevillasoundservices.warningshot"
minSdkVersion 24
targetSdkVersion 28
versionName '1.0.2'
versionCode 3
}
The versionCode
is an incremental integer that is used to determine which version is higher than the other. I think this is only enforced on signed APKs, that's why you haven't seen the error earlier.
More info can be found in Android Developer Guides
Answered By - Leo
Answer Checked By - Terry (JavaFixing Volunteer)