With the kind help of
@simwhi in this thread I have managed to get the Google Play Services plugin partially working in Android Studio. I am using the example code from the plugin folder (C:\Gideros\All Plugins\googleplay\examples\GooglePlayTest)
I have exported as Android with Android Studio selected
I have imported the exported project into Android Studio
I have copied all the folders required (see screen dump 1)
I have modified my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="<a href="http://schemas.android.com/apk/res/android"" rel="nofollow">http://schemas.android.com/apk/res/android"</a>;
package="com.antix.gpservices"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
<!-- TAG:MANIFEST-EXTRA -->
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<supports-screens android:largeScreens="true"
android:smallScreens="true"
android:normalScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<application android:icon="<a href="https://forum.giderosmobile.com/profile/drawable%2Ficon%26quot" rel="nofollow">@drawable/icon"</a>; android:label="<a href="https://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name"</a>; android:theme="<a href="https://forum.giderosmobile.com/profile/android" rel="nofollow">@android</a>:style/Theme.NoTitleBar.Fullscreen">
<activity android:label="<a href="https://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name"</a>; android:name="com.giderosmobile.android.gpservicesActivity" android:launchMode="singleTask" android:screenOrientation="portrait" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="<a href="https://forum.giderosmobile.com/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version"</a>; />
<!-- TAG:APPLICATION-EXTRA -->
</application>
</manifest> |
I have created version.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">7</integer>
</resources> |
I have modified build.gradle (module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.antix.gpservices"
minSdkVersion 9
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:7.8.0'
compile files('libs/gideros.jar')
} |
After doing all of that I can actually build my project without it spitting the dummy, but when I try to debug it on my device I get the following crash..
07-06 20:38:47.098 20866-20960/com.antix.gpservices E/AndroidRuntime: FATAL EXCEPTION: GLThread 814
Process: com.antix.gpservices, PID: 20866
com.giderosmobile.android.player.LuaException: C:/Projects/Android Studio/gpservices/app/src/main/assets/assets/main.lua.jet:37: module 'googleplay' not found:
no field package.preload['googleplay']
no file './googleplay.lua'
no file '/usr/local/share/lua/5.1/googleplay.lua'
no file '/usr/local/share/lua/5.1/googleplay/init.lua'
no file '/usr/local/lib/lua/5.1/googleplay.lua'
no file '/usr/local/lib/lua/5.1/googleplay/init.lua'
no file './googleplay.so'
no file '/usr/local/lib/lua/5.1/googleplay.so'
no file '/usr/local/lib/lua/5.1/loadall.so' |
Can anyone assist me with this?
Comments
Load plugin library in main Activity: System.loadLibrary("gms");
Add external class: "com.giderosmobile.android.plugins.googleplaygame.GGooglePlay"
I will try in the morning
Unfortunately I don't know how much have changed from Google Play point of view:
https://github.com/gideros/gideros/blob/master/plugins/googleplay/android_install.html
it should also be available in Gideros/All Plugins/googleplay folder
so I think you need to somehow reference google-play-services in Android Studio.
my guess would be it is to list it as dependency in build.gradle as specified here:
https://developers.google.com/android/guides/setup
I'll try 8.4.0 directly and report back.
Likes: antix
Likes: antix
Thanks for trying to help though, I appreciate it, even if I'm too stupid to grasp what you are trying to have me do.
I would be willing to have a look at Gaming interface, does that do Achievements, Leaderboards, and In App Purchases too? There doesn't seem to be any docs or anything in it's folder though.
I've made some fairly garbled notes here:
http://giderosmobile.com/forum/discussion/6553/android-studio-google-play-services#Item_21
Hope you can make sense of it. A few gotchas that weren't in the docs and largely a case if using an older version of the google play library.
Hope it helps and sorry if it's incoherent
Likes: antix