signing APK

  • I have a game that I want to publish as an app with admob. I've been searching for this for a while but I can't seem to get it right (I might be missing something). I've tried a method using android studio which keeps building Gradle infinitely when trying to open. I can't be the only one having this issue.

    Is there any straightforward way to go from building in construct 3 to signed apk?

  • Have a look at this tutorial.

    It covers building your app in C3 and signing the resulting APK. Granted signing is rather complicated so I wouldn't necessarily call it straightforward!

  • ah a detailed tutorial!

    I figured the signing was complicated, wish I knew what it actually did!

    thanks a bunch!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I wish I understood what I'm looking at right now,

    using the tutorial mentioned above, everything went well until the actual signing. it gives me the following error

    -Djava.ext.dirs=C:\Users\krisv\AppData\Local\Android\sdk1\build-tools\25.0.3\lib is not supported. Use -classpath instead.

    Error: Could not create the Java Virtual Machine.

    Error: A fatal exception has occurred. Program will exit.

    anyone know what to do here? I've got the key and the alligned apk in the folder I'm running the command on

  • I might have referenced to the wrong apksigner, there is a windows batch file in buildtools\25.03\ and a jar file in buildtools\25.03\lib\ for some reason I can't get either to work though.

  • If you have an apk, can you not just use something like ZipSigner 2 from the play store to sign with your key?

    (I've created apk's this way in the past on other systems)

    My way of using Android studio is to get the exported folder with all the stuff generated from Cordova export:

    Below is all command line stuff: (btw I run JAVA8)

    go into the exported project folder and type cordova platform add android (make sure you installed the cordova command line package, I installed the nodejs one)

    Then had to sort out icon manually in android_manifest.xml ... find android:icon="@mipmap/screen" in this file

    copy (containing screen.png) all folders mipmap-xxxx , there's 6 of them! e.g.

    C:\Users\ACER\Download\Life Points Calculator\platforms\android\res\mipmap-hdpi

    (example manifest.xml below)

    in [apk name]\platforms\android

    <?xml version='1.0' encoding='utf-8'?>

    <manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0" package="com.shader.effect" xmlns:android="http://schemas.android.com/apk/res/android">

    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application android:hardwareAccelerated="true" android:icon="@mipmap/screen" android:label="@string/app_name" android:supportsRtl="true">

    <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">

    <intent-filter android:label="@string/launcher_name">

    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />

    </intent-filter>

    </activity>

    </application>

    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    </manifest>

    Next, BUILD apk in Android Studio

    ------------------------------------------------

    close any open project first

    import project > gradle etc.. >

    e.g Downloads\ShaderEffectsAPK\platforms

    click on Android folder (do not go into it) and import

    if any errors (see above about icon) > sort them > Clean Project

    BUILD apk (Point to your local keystore.jks, will ask for password) by using Build > Generate Signed APK

    copy apk to phone and install.

  • insanesnake - you probably need to post the actual command you used for anyone to be able to help. Otherwise we're just guessing what you typed in.

  • the complete command I ran is

    C:\Users\krisv\Desktop\Signing>C:\Users\krisv\AppData\Local\Android\sdk1\build-tools\25.0.3\apksigner.bat sign --ks release-key.jks --out signed.apk aligned.apk

    which gives me the java virtual machine error above.

    I also tried

    C:\Users\krisv\Desktop\Signing>C:\Users\krisv\AppData\Local\Android\sdk1\build-tools\25.0.3\lib\apksigner.jar sign --ks release-key.jks --out signed.apk aligned.apk

    which doesn't seem to do anything at all.

    I currently have worked around it thanks to htmlgames, but I would like to know how to do it trough cmd.

    I did use the tutorial and named the key and alligned apk accordingly

    thanks in advance

  • I wish I understood what I'm looking at right now,

    using the tutorial mentioned above, everything went well until the actual signing. it gives me the following error

    -Djava.ext.dirs=C:\Users\krisv\AppData\Local\Android\sdk1\build-tools\25.0.3\lib is not supported. Use -classpath instead.

    Error: Could not create the Java Virtual Machine.

    Error: A fatal exception has occurred. Program will exit.

    anyone know what to do here? I've got the key and the alligned apk in the folder I'm running the command on

    I'm having the same exact error after following the guide. Here are my results:

    C:\Users\Sean\Desktop\LBP GoolePlayPublish>c:\users\Sean\AppData\Local\Android\sdk\build-tools\26.0.2\apksigner sign --ks release-key.jks --out signed.apk aligned.apk

    -Djava.ext.dirs=c:\Users\Sean\AppData\Local\Android\sdk\build-tools\26.0.2\lib is not supported. Use -classpath instead.

    Error: Could not create the Java Virtual Machine.

    Error: A fatal exception has occurred. Program will exit.

  • well if you want to publish it fast you can do it with zipsigner, open construct 3 on phone, publish the unsigned release. download it on your phone and then use zipsigner. it'll allign and sign it. make sure to change the output to apk. my app is on google play because of it

  • I've been doing some digging and still can't get it to work. Are there any other alternatives than zipsigner?

  • Most of the time you can fix this problem by uninstalling the Java runtime and then reinstalling it all over again. If you have both 32- and 64-bit applications that need to use Java, then you’ll need to download and install both versions of the Java runtime. Hopefully, this will fix your problem. Sometimes this error can be caused by not having enough system memory allocated to the Java Virtual Machine – or not enough system memory. In this case try the following :

    Tap on Windows-Pause to open the System Control Panel applet. You can alternatively open the control panel manual to go there if you prefer it that way.

    Click on advanced system settings on the left.

    Select environmental variables here.

    Click on new under System Variables.

    Enter _JAVA_OPTIONS as the variable name.

    Enter -Xmx512M as the variable value.

    Click ok twice.

    This allows up to 512MB to be allocated to the Java virtual machine. You can experiment with different values, if required. That's it, your Java program should now be able to execute properly.

    For those interested, Java -Xmx/s is the configuration parameter that control the amount of memory Java uses.

    Xmx sets the maximum heap memory size

    Xms sets the minimum heap memory size

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)