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 / Tier 2 Android Compile on a Mac

Author
Message
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 13th Apr 2018 01:06
I have a mac book pro and I'm easily able to build and run tier 2 apps for iOS and Mac. However, when I load up android studio I can't get the android template to compile successfully.

All of the guides that have been published discuss using android studio on a windows machine. Has anyone been able to build android on a mac and how did you do it?

Any guidance would be greatly appreciated.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Apr 2018 16:59
What errors do you get when you try to compile?
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 14th Apr 2018 04:41
I took the google android template and created a copy of it in the same directory as the original so the relative paths to all supporting files would be correct. I opened the copy up in android studio and said no to any graddle updates.

Once again this is on my mac book pro.
I then just tried to build and I get the following errors which i will attach files showing screen shots.




Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Apr 2018 16:46
In the SDK Manager, in the SDK Tools tab, check you have the latest version of Google Play Services installed, you may also need to update the Android Support Repository, Google Repository, Android Support Library, Google Play Licensing, Google Play Billing, and Google Play APK Expansion Library
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 17th Apr 2018 00:19
Android template still doesn't work on mac for tier 2. Not sure if it has anything to do with the NDK. I had all the latest sdk components and I still get the same error. No problem on ios and mac templates with xcode. I am about to give up because this shouldn't be this difficult for a template this is supposedly pre-configured.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Apr 2018 16:04
It looks like there is a dependency missing for the Google template project for "play-services-auth:11.8.0". Open the build.gradle file for the AGK2Template module and add it at the bottom, the total dependencies section should look like this


Sorry, I'll get that fixed for the next version.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 18th Apr 2018 17:20
Thank you for looking into this, I really appreciate it. I will try editing the build.gradle tonight and I'll let you know.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 18th Apr 2018 17:49
Quick side note and question on the Android template on a mac. All the directions I have found so far talk about using the NDK on a windows machine to compile the c++. How do you go about setting things up properly to compile and make the c++ code for android on a mac ?
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 01:03
I added that to the build.graddle and I included in the attached screen shot. It's still not compiling You can see the errors in the screen shot.

Attachments

Login to view attachments
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 01:07
Also saw this error

Outdated stub in index: jar:///Users/robertgreenberg/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle-core/3.1.1/fefc85578f816ce0e50d58852491febb3b4d907a/gradle-core-3.1.1-sources.jar!/com/android/build/gradle/internal/api/ApkVariantOutputImpl.java null, doc=DocumentImpl[jar:///Users/robertgreenberg/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle-core/3.1.1/fefc85578f816ce0e50d58852491febb3b4d907a/gradle-core-3.1.1-sources.jar!/com/android/build/gradle/internal/api/ApkVariantOutputImpl.java], docSaved=true, wasIndexedAlready=true, queried at 1523575420603
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 01:18
I was able to get the project to build by going to where the GoogleSignIn issues were and pressing option enter on my mac. The solution finally built. I tried deploying to the android emulator and the app started then crashed.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 01:22
This is what I'm seeing in the logcat

--------- beginning of crash
04-19 00:20:38.353 5276-5276/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.mytemplate, PID: 5276
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.mytemplate/com.thegamecreators.agk_player.AGKActivity}: java.lang.IllegalArgumentException: Unable to find native library android_player using classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/base.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/lib/x86, /system/lib, /vendor/lib]]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalArgumentException: Unable to find native library android_player using classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/base.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.mytemplate-w-yBqE3XHr-KZABx991NzQ==/lib/x86, /system/lib, /vendor/lib]]]
at android.app.NativeActivity.onCreate(NativeActivity.java:160)
at com.thegamecreators.agk_player.AGKActivity.onCreate(AGKActivity.java:30)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
04-19 00:20:38.358 5276-5276/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
... 9 more
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 02:11
I think when I clicked option enter that I just stubbed out

GoogleSignInClient

GoogleSignInStatusCodes

getSignInIntent

So not sure what I am missing. I have all the latest sdk items and I updated the graddle file.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 19th Apr 2018 03:13
It looks like everything is fine on the Java side now, so I wouldn't change anything there. In your last error the key line is near the top "Unable to find native library android_player", that is the C++ component that you will need to compile using the NDK.

On Windows we provide a bat file that does this in "template_android_google\AGK2Template\src\main" called jniCompile.bat. I've never tried compiling an Android NDK project on Mac or Linux, but the process should be the same using the terminal window. Find the ndk-build executable in the NDK you downloaded (either the one you downloaded in Android Studio or it can be downloaded separately) and run it with the "main" folder as the working directory with the same command line options used in the jniCompile.bat.

Once you have compiled the NDK portion of the app you can go back to Android Studio and build the app again, this time it should notice the native libs and include them in the APK for you.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 19th Apr 2018 10:42
I will give that a shot tonight. Thanks again for your help and assistance.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 20th Apr 2018 02:39
I can't get it to work on a mac. I was able to run ndk build but I can't determine which files to copy where. The windows batch file is a little confusing. To be honest I'm giving up this. I have way to much time trying to get this to work.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Apr 2018 13:46
In the terminal window browse to the "template_android_google\AGK2Template\src\main" folder, then run the following command


That should be it, then you can build the project in Android Studio.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 20th Apr 2018 15:38
I will try that, but I think that is what I did. I'm not near that computer right now, so I'll have to look later.

After I ran the compile last night I wasn't getting couldn't find the Player anymore. I was still getting an error listed in a previous message
- Cannot find symbol class GoogleSignInClient
- Cannot find symbol variable GoodleSignInStatusCode

When I google those error messages I found some info that it could be cause by the versions of dependencies listed in the build.gradle file.

I'll look again, but I thought I would give you this additional info.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 21st Apr 2018 01:09
So I ran the ndk-build successfully but I am still getting 2 errors.

AGK2Template/src/main/java
com/thegamecreators/agk_player/AGKHelper.java
error: cannot find symbol class GoogleSignInClient
error: cannot find symbol variable GoogleSignInStatusCodes
uses unchecked or unsafe operations.

When I google the error I get some info about versions of what is in the build.gradle file.

Do you have any ideas ? I think this is the last issue.

Thank you
Parry
AGK Developer
14
Years of Service
User Offline
Joined: 16th Dec 2009
Location: Swampstone
Posted: 21st Apr 2018 19:57 Edited at: 23rd Apr 2018 15:33
I missed this thread probably because I'm using Windows. I'm having the same issue with the APK crashing on launch. I have ran ndkbuild batch file jnicomplie successfully too. Anyone been able to launch a apk successfully?

My thread on the issue https://forum.thegamecreators.com/thread/222088

EDIT: I found my mistake. I didn't update my NDK to version r16b.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Apr 2018 14:40
It seems Android Studio may not automatically be including the necessary imports. Near the very top of AGKHelper.java is an import section, that you may have to expand to see fully. Near the top of this section should be several lines that import from com.google.android.gms.auth.api.signin, there should be five of them like so
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 24th Apr 2018 02:14
Well I was able to finally build the android template without any errors. I did try running this template, no changes other than what you listed in this thread, on the android emulater and my galaxy s8 and got the following error. The app starts then instantly crashes.

04-24 01:12:10.910 7649-7649/com.mycompany.mytemplate E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.mytemplate, PID: 7649
java.lang.UnsatisfiedLinkError: Unable to load native library "/data/app/com.mycompany.mytemplate-3IBanVlnRS-rM8m0zAIcIQ==/lib/x86/libandroid_player.so": undefined symbol: ANativeActivity_onCreate
at android.app.NativeActivity.onCreate(NativeActivity.java:174)
at com.thegamecreators.agk_player.AGKActivity.onCreate(AGKActivity.java:30)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
04-24 01:12:11.242 7649-7681/com.mycompany.mytemplate V/FA: Collection enabled
App package, google app id: com.mycompany.mytemplate, 1:960969182309:android:7896ddd39945e2c1
04-24 01:12:11.303 7649-7681/com.mycompany.mytemplate I/FA: App measurement is starting up, version: 11910
To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.mycompany.mytemplate
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Apr 2018 02:17
It seems you have the same error that Parry got in his thread, he solved it by using the 16b version of the NDK. It can be downloaded and used separately from Android Studio if necessary.
RGBZ
7
Years of Service
User Offline
Joined: 19th Apr 2017
Location:
Posted: 24th Apr 2018 02:24
You are right. I was just looking at his thread. I had the newest version of the ndk installed, but I was pointing to a directory that had an old version. I recompiled with the latest ndk and the app is now running in my emulator.

So all the changes you mentioned worked: The missing graddle entry and the missing imports in the agkhelper


Thank you !!!!!!

Login to post a reply

Server time is: 2024-11-23 21:59:09
Your offset time is: 2024-11-23 21:59:09