mirror of https://github.com/auygun/kaliber.git
Use gn target name for the native lib
This commit is contained in:
parent
35958b13f7
commit
dd14ed30ea
|
@ -47,6 +47,7 @@ android {
|
|||
applicationId 'com.woom.game'
|
||||
resValue "string", "app_name", "woom"
|
||||
resValue "string", "interstitial_ad_unit_id", "ca-app-pub-1321063817979967/8373182022"
|
||||
resValue "string", "admob_application_id", "ca-app-pub-1321063817979967~1100949243"
|
||||
manifestPlaceholders = [appIcon: "@mipmap/ic_launcher"]
|
||||
ext {
|
||||
gnTarget = "demo"
|
||||
|
@ -96,6 +97,16 @@ android {
|
|||
abiFilters = ["x86_64", "x86"]
|
||||
}
|
||||
}
|
||||
|
||||
// Native library name is same as GN target name.
|
||||
android.productFlavors.each { flavor ->
|
||||
if (flavor.dimension == 'game') {
|
||||
"${flavor.name}" {
|
||||
resValue "string", "lib_name", flavor.ext.gnTarget
|
||||
buildConfigField 'String', 'NATIVE_LIBRARY', "\"${flavor.ext.gnTarget}\""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
@ -175,14 +186,12 @@ utils.addGameTask('copyAssetsFor') { String taskName, String buildType, String a
|
|||
}
|
||||
|
||||
// Copy the native library to a directory denoting its arch code as the Android Gradle plugin expects.
|
||||
// Also rename it to `libkaliber.so` which is the name expected by the engine.
|
||||
utils.addGameTask('copyJniLibsFor') { String taskName, String buildType, String arch, String game ->
|
||||
task(taskName, type: Copy) {
|
||||
dependsOn "runNinjaFor${game}${arch}${buildType}"
|
||||
|
||||
from("${utils.getOutDir(buildType)}/${arch}") {
|
||||
include "lib${utils.getGnTargetFor(game)}.so"
|
||||
rename "lib${utils.getGnTargetFor(game)}.so", "libkaliber.so"
|
||||
}
|
||||
into "${utils.getJniLibsDir(buildType)}/${utils.getAbiCodeFor(arch)}"
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="kaliber" />
|
||||
android:value="@string/lib_name" />
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||
android:value="ca-app-pub-1321063817979967~1100949243" />
|
||||
android:value="@string/admob_application_id" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
<resources>
|
||||
<string name="app_name">Kaliber app</string>
|
||||
<string name="interstitial_ad_unit_id"></string>
|
||||
<string name="admob_application_id">ca-app-pub-3940256099942544~3347511713</string>
|
||||
</resources>
|
||||
|
|
|
@ -32,7 +32,7 @@ public class KaliberActivity extends NativeActivity {
|
|||
|
||||
static {
|
||||
// Get the native Java methods bound to exported functions.
|
||||
System.loadLibrary("kaliber");
|
||||
System.loadLibrary(BuildConfig.NATIVE_LIBRARY);
|
||||
}
|
||||
|
||||
private InterstitialAd mInterstitialAd;
|
||||
|
|
Loading…
Reference in New Issue