Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Amazon Underground. Issue with the standed Classes.dex file

Author
Message
SpinieBop
9
Years of Service
User Offline
Joined: 10th Oct 2014
Location: Australia
Posted: 30th Oct 2015 01:26
I hope someone can help me with this,

Is there a quick and easy way to create a Classes.dex file which has an extended NativeActivity class to use with AppGameKit Tier1 version 2. The solution below from Amazon requires me to create one using Tier2 and Eclipse. Does anybody have a Classes.dex file I could use that address this issue that I can use to create my APK via Tier1 IDE?

Amazon got back to me with why my app is not recording any minutes engaged, they said;
In order to accurately track Minutes Engaged, Amazon Underground requires users to submit their APK with the following:

The <application> element in your AndroidManifest may not contain:
android:hasCode=“false”

Additionally, applications using android.app.NativeActivity are not supported. Instead, you may subclass the NativeActivity class by extending from it:
public class MyNativeActivity extends android.app.NativeActivity { }

I am using Tier1 version 2

Amazon's solution;

Tier 1 – BASIC implementers using the engine
• The engine does not support custom plugins so there’s nothing we can write to generate this stub.
• The resulting APK built by the engine uses a precompiled classes.dex along with a shell AndroidManifest.xml meaning it doesn’t actually do any java compilation. Keeping this in mind, our only option is to use a pre-built classes.dex that already contains a java class that extends NativeActivity.
o Steps to get this to work.
 Build an APK with the AppGameKit libraries, the same way would using Tier 2 from this documentation (http://www.appgamekit.com/documentation/guides/25_android.htm).
 Make all changes in our Tier2 instructions and export an APK from Eclipse according to the documentation linked.
• By this point, you should have a sample app that has a java class stub.
 Replace precompiled classes.dex with the one from your stub APK
• Take the APK you just built and change the extension to .zip and unzip it.
• Inside the folder containing the unzipped files, simply take out the classes.dex.
• Find the existing precompiled classes.dex used by AGK
o Check the installation location and find the Amazon pre-builts.
 On Mac, mine was <AGK_Folder>/Contents/Resources/share/geany/android/sourceAmazon/classes.dex
• Replace the classes.dex in the AppGameKit folder from the previous step with the one from the APK you built.
• Update the AndroidManifest.xml to point at the Activity you created
o The AndroidManifest.xml we need to modify lives in the same folder as the classes.dex we just replaced.
o Go to the location of the AppGameKit classes.dex we modified and open the AndroidManifest.xml
o Change all usages of “android.app.NativeActivity” with the full name of the Activity you created in the APK you built following the previous instructions.
o Save it and close
 Re-export an APK from the AppGameKit IDE and verify that it works as expected


Kevin
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2015 23:10 Edited at: 2nd Nov 2015 23:13
We ran into the same issue when we tried to submit an app to Amazon Underground. Unfortunately the instructions from Amazon mean that the package name must be hard coded into the classes.dex file, so it will be different for every user, and every app, so the IDE export process can't be modified to support it in the general case. It can be modified to support a particular app by replacing the export process classes.dex with one for a particular app, as they suggest.

To create such as classes.dex you will need to compile it with Eclipse and the Android SDK. You don't need to go through the entire Tier 2 process, you can ignore anything to do with cygwin or NDK. Unfortunately Google have moved away from Eclipse and on to Android Studio so it may be difficult to get setup with Eclipse and the Android SDK now, but if you want to give it a go here is what you need to do.

* Install the Java Development Kit, Eclipse, and the ADT plugin.
* In the Android SDK Manager install the "SDK Platform" from "Android 3.2 (API 13)", also install the "Android SDK Tools" and "Android SDK Platform-tools" from the "Tools" section.
* Import the "interpreter_ouya_lite" project into Eclipse from the AGK\Tier 2\apps folder. This is the simplest project for Android so if you don't need IAP, Ads, Facebook, or push notifications then it makes things much easier to use this one.
* At this point you should try building the Ouya Player Lite project and running it on a device to check everything is working.
* Notice in the interpreter_ouya_lite/src folder the folder structure follows the package name, in this case "src/com/thegamecreators/agk_player", make some new folders that follow your own package structure, for example "src/com/mycompany/mygame"
* In this new folder create a new file called CustomNativeActivity.java with the following contents

* Replace com.mycompany.mygame with your package name. Any time I mention com.mycompany.mygame from now on, replace it with your package name.
* In src\com\thegamecreators\agk_player\MyJavaActivity.java replace
with

* In the AndroidManifest.xml file replace the line
with

* Test building and running the modified project in Eclipse, hopefully it should still work.
* Right click on the project in Eclipse and choose Export , select Export Android Application and click Next
* The project should already be selected so click Next again
* Enter your keystore details, or generate a new one, it doesn't matter which one you use
* Once you have exported the APK rename it to .zip and extract it somewhere.
* Copy the classes.dex into the AppGameKit IDE folder, on Windows this will be "AGK\Tier 1\Editor\data\android\sourceOuya"
* Also in this folder is another AndroidManifest.xml file, open it and make the same change we made earlier replacing
with

* Do not add or remove anything else from this file, it is purposefully missing its top half
* The AppGameKit IDE should now be able to export APKs using the the Ouya drop down menu that will be compatible with Amazon Underground, but only for the specific package name that you used.

Login to post a reply

Server time is: 2024-09-29 07:32:39
Your offset time is: 2024-09-29 07:32:39