versionCode error

I am revved up and read to upload my app the Android Marketplace, but I get this error from their website:

"Market requires versionCode to be set to a positive 32-bit integer in AndroidManifest.xml."

When I build the app, the version is set to 1. Am I missing something?

Thanks a bunch guys. You're all awesome when it comes to support.

-Cullen

What does your build.settings say? You may have to add this to your build.settings file:

1
2
3
4
android =
                {
                        versionCode = "1"
                },

I added the code and it still says "1.0" on my phone and not "1".

I thought that the version you put down during the build is what was signed to your app.

Any more input? Thanks!

I can edit version code and version name with decompiling my game.
Use apktool to decompile your game: http://code.google.com/p/android-apktool/
Then edit version code and version name in AndroidManifest.xml (you can use texteditor for that). After that use apktool to recompile your game. Then just re-sign your game using same keystore when you build your game first time with Corona. And then you should be able to publish your game.

Dang.

So you weren't able to get your app to display a correct version number either?

I'd rather not use the apk tool every time I build an app. Any way past this?

Thanks though for the work around.

I can set correct VERSION CODE with corona. VERSION CODE must be number like 1, 2, 3...
But i cant set correct VERSION NAME with Corona. VERSION NAME must be like 1.0, 1.1, 1.2 ...
In android if you go to settings->applications->manage applications and select your game, you can see VERSION NAME (for example 1.0). There shouldnt read "1".

If you build your game and only test it in real phone, it is same what version code and version number you have. But when you publish your game to market, you should use apk tool to set version code and version number what you like.

By the way, i am using corona windows version.

When I go into "manage applications" my app is listed as "1.0". I was under the impression, as a result of other threads here on Corona, that I needed a "1" without a decimal value.

I went into my build.settings and changed my version code to "1". Is there any way at all that I can change the version NAME without using apktool? I've been looking online and cannot find a step by step guide in its use.

Thanks a bunch.

I can't even find out how to install the apk-tool O.o

I'm following the guide here for manifest editing:
http://www.base2solutions.com/walkabout/Corona%20Tips.html#7

I get along just fine until I have to place an .apk file in the apktool folder that doesn't exist.

Help!
(thanks)

http://www.base2solutions.com/walkabout/Corona%20Tips.html#7 guide is for APK MANAGER. I dont know why, but apk manager doesnt work for me with latest Corona sdk daily builds. I just get error when i try to decompile my game. So i started to use APK TOOL, which work well.
Step by step guide to use apktool:
Download http://android-apktool.googlecode.com/files/apktool1.4.1.tar.bz2
and http://android-apktool.googlecode.com/files/apktool-install-windows-r04-brut1.tar.bz2
Then extract both files to SAME FOLDER.
Then you should have "aapt.exe", "apktool.bat" and "apktool.jar" files in SAME FOLDER.
Now copy your .apk file to same folder.
Then start cmd.exe application, you can start it with searching "cmd" in windows start menu.
Then put this code to cmd and press enter:
"cd C:\Users\YOURUSERNAME\Documents\apktool"
PATH must be to your apktool folder. Path i wrote previously is just example.
Then put this code to cmd: "apktool d YOURAPKNAME.apk OUTPUTFOLDER"
Now apktool decompiles your apk and creates new folder, in previous code it creates folder called OUTPUTFOLDER
Then go to new folder and edit AndroidManifest.xml
Then put this code to cmd: "apktool b OUTPUTFOLDER YOURNEWAPKNAME.apk"
Then apktool recompiles new apk from your folder
And you are almost done, to publish your game to market, you need to re-sign your game with keystore you used to build it with corona.

That all sounds really complicated, but when you do that couple times, it takes only few minutes.

Thank you so much. I have apktool running now and it creates the output folder specified.

However there isn't an .XML file in the folder, just a ton of sub-folders with .smali formats.

Is that supposed to happen?

The .apk is nothing but a ZIP file, so if you rename it and unzip it, you can get to its resources inside and then you can edit/alter whatever you want and repackage it by zipping it and renaming the .zip to .apk

cheers,

?:)

I would have loved for that to work. I got into the source, opened the .XML file and found that everything became garbled.

What would happen if I replaced it with my own .XML file?

Why doesn't corona support correct versionCode and versionName editing?

Thanks a ton.

Yes you can unzip apk, but then if you try to edit AndroiManifest.xml, you can see that it is in some kind of binary format or something. So you cant not edit it.
Apk tool decodes AndroidManifest.xml to editable mode.

cullenjwebb, i dont know why it is not working. For me it works perfectly, and i can see AndroidManifest.xml in folder.

About replacing xml with your own, it might be possible. But apps made with corona, has some corona stuff in AndroidManifest.xml
Here is example AndroidManifest.xml from app made with corona:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1" android:versionName="1.0" android:installLocation="auto" package="PUT_YOUR_PACKAGE_IDENTIFIER_HERE"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-feature android:glEsVersion="65537" />
    <application android:label="YOUR_GAME_NAME" android:icon="@drawable/icon" android:debuggable="true">
        <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="YOUR_GAME_NAME" android:name="com.ansca.corona.CoronaActivity" android:launchMode="singleTask" android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:name="com.ansca.corona.FileContentProvider" android:authorities="YOUR_PACKAGE_IDENTIFIER.files" />
        <activity android:theme="@style/OFNestedWindow" android:label="IntroFlow" android:name="com.openfeint.internal.ui.IntroFlow" android:configChanges="keyboardHidden|orientation" />
        <activity android:theme="@style/OFNestedWindow" android:label="Dashboard" android:name="com.openfeint.api.ui.Dashboard" android:configChanges="keyboardHidden|orientation" />
        <activity android:theme="@style/OFNestedWindow" android:label="Settings" android:name="com.openfeint.internal.ui.Settings" android:configChanges="keyboardHidden|orientation" />
        <activity android:theme="@style/OFNestedWindow" android:label="NativeBrowser" android:name="com.openfeint.internal.ui.NativeBrowser" android:configChanges="keyboardHidden|orientation" />
        <activity android:name="com.adknowledge.superrewards.ui.activities.SRPaymentMethodsActivity" android:screenOrientation="portrait" />
        <activity android:name="com.adknowledge.superrewards.ui.activities.SRDirectPaymentActivity" android:screenOrientation="portrait" />
        <activity android:name="com.adknowledge.superrewards.ui.activities.SROfferPaymentActivity" android:screenOrientation="portrait" />
        <activity android:name="com.adknowledge.superrewards.ui.activities.SRWebViewActivity" android:screenOrientation="portrait" />
        <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:name="com.zong.android.engine.web.ZongWebView" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="com.adknowledge.superrewards.ui.activities.SRZongPaymentActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.maps" />
        <service android:name="com.zong.android.engine.process.ZongServiceProcess" android:enabled="true" android:exported="false" />
    </application>
</manifest>

Dang uapo15! You are one step ahead of figuring out every road block I am running into with my Android build. Thank you so much for your instructions above, worked like a charm!

Was able to edit save and re-sign and zip align my binary. Just got uploaded to android market.

Thanks again!

uapo15, I am having the same problem with not being able to update my versionCode. Since it works for you, can you post your entire build.settings file as well as the version number of Corona you are running? Also, are you running the Mac or Windows version of Corona?

Thanks in advance.

Here is my build.settings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
settings =
{
        orientation =
        {
                default = "portrait",
                supported =
                {
                    "portrait"
                },
        },
                
            android =
        {
                versionCode = "3"
        },
    
    
}

Awesome, that got it working!

Thanks uapo15 for posting your build.settings file. I guess I had a goofy comma missing or something.

Here is my build.settings file. Even with this I cannot upload my app the the Android Market because of the versionCode error.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
settings =
{
 
 
                                
        orientation =
        {
                default = "landscapeRight",
                                supported =
                                        {
                                                         "landscapeRight", "landscapeLeft"
                                        },
        },
 
                android =
        {
                versionCode = "1"
        },
                
        iphone =
        {
                plist =
                {
                                UIStatusBarHidden=true,
                        UIPrerenderedIcon = true
                },
        }
        
        
}

That is very strange. I dont see any problems in build.settings.
If you cant get it working, you could try to edit manifest after building. That should work.

Well, if editing the manifest is my last bet, would anyone be willing to use remote desktop to get it working on my pc?

I cannot for the life of me get my Manifest extracted. All I get is gibberish.

I would like to mention that you guys have been quick to respond and very helpful.

cullenjweb - Sorry, just want to clarify, did use the apktool and follow uapo15's directions in the above post http://developer.anscamobile.com/forum/2011/07/15/versioncode-error#comment-46027 on how to decompile your apk FIRST before trying to edit the manifest?

It sounds like you are trying to edit the manifest directly, prior to using the apktool. If you change the apk to a zip you can see the file structure but when you try and edit the manifest it's garbled. You must decompile it in order to edit it.

The steps are (I am using my actual command lines below, with my file/keystore names, replace with the name for your own app):

1. decompile the apk using the apktool command line looks like this "apktool d RedneckJellyfish.apk RedneckJellyfish

2. go into the folder that the apktool just created and edit the line in the manifest so that it reads something like this:

3. then recompile using apktool "apktool b RedneckJellyfish RedneckJellyfish_new.apk"

4. then resign your app using the jarsigner (comes with android SDK) "jarsigner -verbose -keystore mudstuffing.keystore
RedneckJellyfish_new.apk mykeyaliasname" where the keystore and the keystore alias is the same what you are using when you build in Corona

5. realign the apk file (this is optional) "zipalign -v 4 RedneckJellyfish_new.apk RedneckJellyfish_final.apk"

6. Submit the final version "RedneckJellyfish_final.apk" to the android market.

I follow the instructions which results with this in the cmd window. All I have in the output folder is a bunch of smali files.

Wierd... And zombieshooter.apk is in the same directory as apktool?

Sorry, I am not sure why it's not working.

Yes, it's the same directory. I get an output, but it's useless smali files.

cullenjwebb,

One possible thing wrong with your build.settings file is your line #27. I think it should have a comma after the brace. I say this because if you compare it to uapo15's posted file, he has a comma at the end of the brace on line #15.

The only other things I can think of is a typo in the filename "build.settings" or it's not in the correct folder (should be in the same place as main.lua).

Thanks for catching that. I have copied and pasted uapo's build.settings into my own and changed only the portrait to landscapeRight.

Shouldn't this make my app version appear as "1" and not "1.0" in manage applications? It's still showing up as "1.0".

VERSIONCODE is "1" and VERSIONNAME is "1.0". If it shows "1.0" in manage applications, it is right. You can not see VERSIONCODE in manage applications. Understant? :)

After countless days fixing one bug after another I finally figured out the problem. You need to use a Mac.

I got the JDK to work on my pc but the next thing you know the app does not install on my android device. If you fix one bug on a pc you end up having to fix a new bug and searching the forums to fix that new bug. Then the new bug creates problems with an old bug. It's just not worth the time to do these work arounds.

Using corona on a Mac to build android game apps will save you a ton of time and stop the agonizing pain of finding work arounds.

Thanks a bunch uapo15!

After copy-pasting your config.lua instead of mine it worked perfectly.

I would like to take the time, however, of suggesting a app for windows:
http://forum.xda-developers.com/showthread.php?t=890199

It works like a charm and lets your edit and decompile your app without any coding at all. It's flippin amazing.

Later!

I'm ran into the same problem, after having published two apps previously:
"Market requires versionCode to be set to a positive 32-bit integer in AndroidManifest.xml."

What is missleading is the error message: in AndroidManifest.xml. From my experienc, not true.

Add the versionCode to you build file, not your xml file. Of course, make sure all your version numbers are the same! Thanks to uapo15, that little bit of info helped.

M

Just a quick note. To use apk manager with the latest corona you need to update this file in the 'Other' folder:

http://www.mediafire.com/?f354aq5u71w5jp6

Apk manager actually uses apktool to do everything, however it also includes the android frameworks jar to verify the options you set in the manifest.

jayantv: the manifest is actually a java compressed xml, and you cant just edit it directly.

Thanks. I updated with the file provided here. The apk will now decompile, but it will not compile, so I am unable to change any manifest items.

Is that just me?

views:2666 update:2011/10/7 17:24:19
corona forums © 2003-2011