mirror of
https://github.com/android/ndk-samples
synced 2025-11-08 00:56:26 +08:00
ported hello-thirdparty to use new 0.6.0-alpha1 native dependencies system
- bumped Google Play Services version to 8.3.0 and Play Games lib version to 2.0 - bumped gradle version to 2.9 - migrated native dependency declaration to the new gradle system supported in gradle-experimental:0.6.0-alpha1 and cleaned up the app build.gradle accordingly - added support for all the architectures supported by Google Play Game Services Signed-off-by: Xavier Hallade <xavier.hallade@intel.com>
This commit is contained in:
61
hello-thirdparty/app/build.gradle
vendored
61
hello-thirdparty/app/build.gradle
vendored
@@ -1,12 +1,23 @@
|
||||
apply plugin: 'com.android.model.application'
|
||||
|
||||
|
||||
def gpg_sdk_path = file(project(':thirdparty:gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
|
||||
|
||||
model {
|
||||
|
||||
repositories {
|
||||
libs(PrebuiltLibraries) {
|
||||
gpg {
|
||||
headers.srcDir "${gpg_sdk_path}/include"
|
||||
binaries.withType(SharedLibraryBinary) { // NOTE: this block should be "StaticLibraryBinary"/staticLibraryFile - but SharedLibraryBinary works and StaticLibraryBinary doesn't as of 0.6.0-alpha1
|
||||
sharedLibraryFile = file("${gpg_sdk_path}/lib/c++/${targetPlatform.getName()}/libgpg.a")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion = 23
|
||||
buildToolsVersion = "23.0.0"
|
||||
buildToolsVersion = "23.0.2"
|
||||
|
||||
defaultConfig.with {
|
||||
//
|
||||
@@ -18,42 +29,34 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions.with {
|
||||
sourceCompatibility=JavaVersion.VERSION_1_7
|
||||
targetCompatibility=JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
android.ndk {
|
||||
moduleName = "native-activity"
|
||||
cppFlags.addAll(["-I${file("src/main/jni")}".toString(),
|
||||
"-I${gpg_sdk_path}/include".toString()])
|
||||
platformVersion = 9 //same as minSdkVersion.apiLevel for better compatibility
|
||||
stl = "c++_static"
|
||||
ldLibs.addAll(["log", "android", "EGL", "GLESv1_CM", "z"])
|
||||
//
|
||||
// NOTE: since libgpg is also linked to the stl:
|
||||
// libc++ explicitly follows it in the list of libraries
|
||||
// to prevent unresolved stl symbols.
|
||||
//
|
||||
ldLibs.addAll(["gpg", "c++_static"])
|
||||
ldLibs.addAll(["atomic", "log", "android", "EGL", "GLESv1_CM", "z"])
|
||||
abiFilters.addAll(["armeabi", "armeabi-v7a", "x86", "arm64-v8a"]) //filtering ABIs on the ones Google Play Games library is compatible with.
|
||||
}
|
||||
|
||||
android.sources {
|
||||
main {
|
||||
jni {
|
||||
dependencies {
|
||||
library "gpg"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android.buildTypes {
|
||||
release {
|
||||
minifyEnabled = false
|
||||
proguardFiles.add(file('proguard-rules.txt'))
|
||||
}
|
||||
}
|
||||
android.productFlavors {
|
||||
create ("arm7") {
|
||||
ndk.abiFilters.add("armeabi-v7a")
|
||||
ndk.ldFlags.add("-L${gpg_sdk_path}/lib/c++/armeabi-v7a".toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.google.android.gms:play-services-games:7.8.0'
|
||||
compile 'com.google.android.gms:play-services-base:7.8.0'
|
||||
compile 'com.google.android.gms:play-services-appstate:7.8.0'
|
||||
compile 'com.google.android.gms:play-services-nearby:7.8.0'
|
||||
}
|
||||
|
||||
compile 'com.google.android.gms:play-services-games:8.3.0'
|
||||
compile 'com.google.android.gms:play-services-base:8.3.0'
|
||||
compile 'com.google.android.gms:play-services-appstate:8.3.0'
|
||||
compile 'com.google.android.gms:play-services-nearby:8.3.0'
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:fullBackupContent="false"
|
||||
android:hasCode="false"
|
||||
android:hasCode="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<meta-data android:name="com.google.android.gms.games.APP_ID"
|
||||
|
||||
2
hello-thirdparty/build.gradle
vendored
2
hello-thirdparty/build.gradle
vendored
@@ -4,7 +4,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
|
||||
classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha1'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
sub module to download the Google Play games
|
||||
*/
|
||||
project.ext {
|
||||
gpg_sdk_link = 'https://developers.google.com/games/services/downloads/gpg-cpp-sdk.v1.4.1.zip'
|
||||
gpg_sdk_link = 'https://developers.google.com/games/services/downloads/gpg-cpp-sdk.v2.0.zip'
|
||||
}
|
||||
task download_and_stage_gpg_sdk(dependsOn:'unzip_gpg_sdk') {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user