Skip to content

Commit

Permalink
add ABI splits
Browse files Browse the repository at this point in the history
  • Loading branch information
NickIliev committed Jun 27, 2019
1 parent 31c6de0 commit 8884c92
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 18 deletions.
49 changes: 44 additions & 5 deletions app/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
// dependencies {
// compile "com.google.android.gms:play-services-base:15.0.1"
// compile 'com.android.support:recyclerview-v7:+'
// }

android {
android {
defaultConfig {
buildToolsVersion "28.0.3"
compileSdkVersion 28
generatedDensities = []
multiDexEnabled true
applicationId = "org.nativescript.curiosity"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 28
ndk {
abiFilters.clear() // ABI Splits related code - I need NDK 17rc1 to ensure proper ABI splits creation
}
}

// ABI Splits related code
splits {

// Configures multiple APKs based on Applicaiton Binary Interfaces (ABI)
abi {
enable true // enables the ABIs split mechanism
reset() // Clears the default list from all ABIs to no ABIs
include 'arm64-v8a', 'armeabi-v7a', 'x86' // Spcifies a list of ABIs Gradle should createa APKs for.
universalApk true // false to skip generting the universal APK
}
}

// ABI Splits related code
sourceSets {
main {
jniLibs.srcDirs = ["$projectDir/libs/jni", "$projectDir/snapshot-build/build/ndk-build/libs"]
}
}

// ABI Splits related code - Different version codes (so I could upload the different splits to Google Console)
project.ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3].withDefault{0}

android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter("ABI"), 0)

if (baseAbiVersionCode != null) {
output.versionCodeOverride = baseAbiVersionCode * 100000 + variant.versionCode
}
}
}

aaptOptions {
additionalParameters "--no-version-vectors"
}

dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
}
}
4 changes: 2 additions & 2 deletions app/App_Resources/Android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="26"
android:versionName="2.8.0">
android:versionCode="27"
android:versionName="2.9.0">

<supports-screens
android:smallScreens="true"
Expand Down
13 changes: 7 additions & 6 deletions app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ export class AppComponent implements OnInit, AfterViewInit {
// Optionally pass in properties for database, authentication and cloud messaging,
// see their respective docs.
onMessageReceivedCallback: (message: any) => {
// console.log(`Title: ${message.title}`);
// console.log(`Body: ${message.body}`);
console.log(`Title: ${message.title}`);
console.log(`Body: ${message.body}`);
// if your server passed a custom property called 'foo', then do this:
// console.log(`Value of 'foo': ${message.data.foo}`);
console.log(`Value of 'foo': ${message.data.foo}`);
},
onPushTokenReceivedCallback: function (token) {
// console.log("Firebase push token: " + token);
onPushTokenReceivedCallback: (token) => {
console.log("Firebase push token: " + token);
setString("device_token", token);
},

// optional but useful to immediately re-logon the user when he re-visits your app
Expand All @@ -101,7 +102,7 @@ export class AppComponent implements OnInit, AfterViewInit {

getCurrentPushToken().then((token: string) => {
// may be null if not known yet
// console.log("Current push token: " + token);
console.log("Current push token: " + token);
});
}

Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.curiosity",
"tns-ios": {
"version": "next"
},
"tns-android": {
"version": "next"
"version": "6.0.0-2019-06-27-141115-01"
}
},
"dependencies": {
Expand Down Expand Up @@ -46,7 +43,7 @@
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-webpack": "next",
"tns-platform-declarations": "~5.4.2",
"tns-platform-declarations": "next",
"tslint": "^5.11.0",
"typescript": "3.4.1"
},
Expand Down
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ module.exports = env => {
],
projectRoot,
webpackConfig: config,
targetArchs: ["arm", "arm64", "ia32"],
useLibs: true,
androidNdkPath: "/Library/android-sdk-macosx/ndk-bundle"
}));
}

Expand Down

0 comments on commit 8884c92

Please sign in to comment.