Skip to content

Commit

Permalink
Update to Gradle 3.3+ and Android Plugin for Gradle 2.3.3.
Browse files Browse the repository at this point in the history
This also migrates the building of native code to cmake/ninja (included with the Android SDK
Tools), getting rid of the deprecated gradle-experimental plugin.
  • Loading branch information
Andreas Schildbach committed Apr 27, 2018
1 parent 2a8c0a1 commit bcb18bd
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 20 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ This project contains several sub-projects:

* __wallet__:
The Android app itself. This is probably what you're searching for.
* __native-scrypt__:
Native code implementation for Scrypt. The C files are copied from the
Java Scrypt project at [GitHub](https://github.com/wg/scrypt).
* __market__:
App description and promo material for the Google Play app store.
* __integration-android__:
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle-experimental:0.7.0'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
exclude group: 'xerces'
}
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include 'wallet'
include 'integration-android'
include 'sample-integration-android'
include 'native-scrypt'
1 change: 1 addition & 0 deletions wallet/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
res/mipmap-*hdpi/
.externalNativeBuild/
25 changes: 11 additions & 14 deletions wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ is world readable/writeable. The goal is to be able to debug easily.

You can probably skip some steps, especially if you built Android apps before.

You'll need git, a Java SDK 6 (or later) and Gradle 2.10 (or later) for this. I'll assume Ubuntu Xenial Linux
You'll need git, a Java6 SDK (or later) and Gradle 3.4 (or later) for this. I'll assume Ubuntu 18.04 LTS (Bionic Beaver)
for the package installs, which comes with slightly more recent versions.

# first time only
sudo apt install git gradle openjdk-8-jdk libstdc++6:i386 zlib1g:i386
sudo apt install git gradle openjdk-8-jdk

Download the [Android SDK Tools](https://developer.android.com/studio/index.html#command-tools)
and unpack to your workspace directory. Point your `ANDROID_HOME` variable to the unpacked Android SDK directory
and switch to it.
Create a directory for the Android SDK (e.g. `android-sdk`) and point the `ANDROID_HOME` variable to it.

Download and install the required Android dependencies:
Download the [Android SDK Tools](https://developer.android.com/studio/index.html#command-tools)
and unpack it to `$ANDROID_HOME/`.

tools/android update sdk --no-ui --force --all --filter tool,platform-tool,build-tools-27.0.3,android-15,android-27
Install the NDK:

Download the [Android NDK](https://developer.android.com/ndk/downloads/), then unpack it to your workspace directory. Point your `ANDROID_NDK_HOME` variable to the unpacked Android NDK directory.
# first time only
$ANDROID_HOME/bin/tools/sdkmanager ndk-bundle

Finally, you can build Bitcoin Wallet and sign it with your development key. Again in your workspace,
use:
Expand All @@ -78,15 +78,12 @@ use:
# each time
cd bitcoin-wallet
git pull
gradle clean :native-scrypt:copy test build
gradle clean test build

To install the app on your Android device, use:

# first time only
sudo apt install android-tools-adb

# each time
adb install wallet/build/outputs/apk/bitcoin-wallet-debug.apk
gradle installDebug

If installation fails, make sure "Developer options" and "USB debugging" are enabled on your Android device, and an ADB
connection is established.
Expand All @@ -106,7 +103,7 @@ separate 'prod' branch that gets rebased against master with each released versi
cd bitcoin-wallet
git fetch origin
git checkout origin/prod
gradle clean :native-scrypt:copy test build
gradle clean test build


### SETTING UP FOR DEVELOPMENT
Expand Down
17 changes: 17 additions & 0 deletions wallet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,20 @@ android {
defaultConfig {
applicationId 'de.schildbach.wallet_test'
generatedDensities = ['hdpi', 'xhdpi']

dexOptions {
preDexLibraries false
}

ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'x86'
}

externalNativeBuild {
cmake {
cFlags '-DHAVE_CONFIG_H'
}
}
}

buildTypes {
Expand All @@ -74,6 +85,12 @@ android {
}
}

externalNativeBuild {
cmake {
path 'cpp/CMakeLists.txt'
}
}

packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'okhttp3/internal/publicsuffix/publicsuffixes.gz'
Expand Down
3 changes: 3 additions & 0 deletions wallet/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.6.0)
add_library(scrypt SHARED scrypt_jni.c crypto_scrypt-nosse.c sha256.c)
include_directories(.)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit bcb18bd

Please sign in to comment.