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.

Android / Android template compile error

Author
Message
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 10th Dec 2012 09:51
Hi All,
I tried to compile the Android template using NDK 6 in Cygwin, I got the error below;



Pls see the attachment of the compile screen.
Anybody know how to solve it ?


Thank you.

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Dec 2012 16:25 Edited at: 10th Dec 2012 16:26
Quote: "Core.cpp:1:17: error: agk.h: No such file or directory"

Did you copy the AGK/IDE directory into your Android setup? (I would guess a yes, since you are trying to do a template.)

Assuming you did copy the directory and didn't delete the wrong subdirs, you are probably experiencing a permissions issue.

Also, the TGC posted Tier 2 Android template is not quite right. The one on the AGK Wiki Template page definitely works.

To avoid or fix some of the permissions issues that might appear, once you copied the AGK/IDE directory into your Android directory, you need to determine the user and group that exist in your cygwin window like this:

The last two commands make sure that you have the proper permissions for everything else that gets done (cleans, compiles, etc.).

If you use Windows File Explorer to copy files from your Windows AppGameKit project to the Android one (when you actually start your own projects in Android), you will want to execute those last two commands in the project directory, just to make sure that Eclipse and cygwin both are able to read and write where necessary.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 11th Dec 2012 18:06
Hi Ancient Lady,
Thanks for the replay. I have download the Android template from wiki page.

I found that I have to copy the the whole \IDE... folders, in order to compile successfully.(Can't not just copy the template to my project folder)
I execute chown and chmod command to the android template folder. Next, I compile the Android template. First attempt, still got error in log.txt that .../obj/local/armeabiv7/libc++...file can not access, no permission. Then I execute chmod 777 ./* in armesbiv7 folder.
Second attempt, compile successfully.

In Eclipse still got some errors. But I have solved it.
Solution as below:
http://http://stackoverflow.com/questions/6185600/android-fbreaderj-gen-already-exists-but-is-not-a-source-folder-convert-to-a-s
http://http://stackoverflow.com/questions/10013445/android-requires-compiler-compliance-level-5-0-or-6-0-found-1-4
http://http://stackoverflow.com/questions/10038460/how-to-get-the-permission-in-ndk
http://http://stackoverflow.com/questions/12767178/unable-to-resolve-target-android-9-in-ndk-application
http://http://stackoverflow.com/questions/6732174/why-suddenly-i-got-the-error-unable-to-resolve-target-android-9
http://http://sagistech.blogspot.com/2010/05/android-sdk-error-unable-to-resolve.html

Now, no error in eclipse. But when I debug Android template, the emulator not showing up "Hello world".
The Logcat got the error: (EGL_Bad_Config).
I have tried AVD 2.3.1, 1.0.3, and 4.1. Still can't solve it.
I think the emulator not compatible with OpenGL ES. Haven't test in device yet. Do u have solution.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Dec 2012 18:51
The Eclipse Android simulator does not work. This is a known issue and TGC doesn't know how to fix it (as of the last time anyone mentioned it).

You need to test it on an actual device.

Once you try to run it in Eclipse, even if the simulator or connection to your device doesn't work, there is an apk file in the bin directory of your Android project that can be installed on any Android device and run directly on it. The trick is getting it to your device. Some people use DropBox (I don't and don't know how, I have my own home network and put the file somewhere that I can download it).

So anyway that you can download that apk file to your Android device will let you test it.

If you don't have an Android device, then you need to find one that can be tested on. (Sometimes friendly people on this forum are willing to try.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 13th Dec 2012 14:50
I tested it on device in Mac - successful.
Tested it on device in Windows - blank screen.

Have u compile the Android template by using Mac Terminal insteads of Cygwin in Windows.
I tried to compile using Teminal but can't make it. If possible, I just use the Mac to compile the new version of Android template in future and no need to use Windows.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 13th Dec 2012 18:52
I haven't been able to get the Eclipse setup working on my Mac, yet. But I haven't put a lot of effort into it, either, since my Windows cygwin/Eclipse works.

It's entirely possible that the Mac version works fine. I'll need to try that again. It may be easier to work with.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 15th Dec 2012 08:19
I found the way to compile Android template in Mac Terminal.


Open, edit, set execute permission and run the .bash_profile

In Terminal
lamkss-Mac-mini:android-ndk-r6b-1 lamks$ open -e ~/.bash_profile

edit .bash_profile (add in 2 line as below) In TextEdit
export PATH=/android-ndk-r8:$PATH export
PATH=/android-ndk-r8:$PATH

Save the file in TextEdit

In Terminal
lamkss-Mac-mini:template_android_v1076 lamks$ chmod u+rwx ~/.bash_profile
lamkss-Mac-mini:template_android_v1076 lamks$ ~/.bash_profile




Compile the Android template in Android template folder
In Terminal
lamkss-Mac-mini:template_android_v1076 lamks$ ndk-build


Remark : If I compiled using NDK 6, error will come out. NDK 8 is ok.


Additional info:
I add in vector in agk template using the way as below in iOS and Android version.

#include <vector>


std::vector<int> abc;
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Dec 2012 17:44
That looks promising. Did the process create a new template_android_v1076.apk file in the project bin directory?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 16th Dec 2012 05:34
Terminal won't create the bin folder and apk file. It just compile the cpp file.
After compiling, I have to open with Eclipse to debug it. Then the Eclipse will create the bin folder and apk file. Eclipse won't compile the cpp file but it will create the apk file if u not configure Eclipse to link with NDK.

If u don't want to use terminal, u can configure Eclipse to link with NDK. The instuction is as below:

Right click project and select property - builder - new - program - main tab.Location:/android-ndk-r8/ndk-build (manually key in n point to your ndk folder, don't click the button)
main tab.Working directory : (pls select your project by clicking browse workspace button)

I started this post because the Android template downloaded from thegamecreatrs.com got error.
The error appear because I was not copy the whole IDE folder together with the android template and copy the android template to ide/templates folder.
And I thought that the template download from the thegamecreators.com have to compile using Cygwin first before open with Eclipse.

Now, I copy the Android_1076_Tier_2_Template to ide/templates folder. Open the android template with Eclipse. Then configure Eclipse link to NDK. The template compile successfully. No need Terminal or Cygwin.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Dec 2012 17:25
Quote: "Terminal won't create the bin folder and apk file. It just compile the cpp file."

That's what I thought. But your post seemed to indicate that it was creating the apk file.

The template posted in the TGC 'My Projects' page does have some issues. Have you tried the templates on the AGK Wiki Templates page?

I will try your NDK-Eclipse link. That would certainly simplify the building process. Thank you.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kslam212003
11
Years of Service
User Offline
Joined: 10th Dec 2012
Location:
Posted: 17th Dec 2012 13:43
I have tried Android template in AppGameKit Wiki Templates page and Android Template download from TCG(Android_1076_Tier_2_Template), both can compile properly and show up "HelloWorld" on device.

Login to post a reply

Server time is: 2024-04-19 13:52:42
Your offset time is: 2024-04-19 13:52:42