Skip to content

Commit

Permalink
Merge pull request #8 from qichuan/feature/update_sdk
Browse files Browse the repository at this point in the history
Update the gradle plugin, support library and SDK
  • Loading branch information
qichuan authored Aug 22, 2018
2 parents 0e4604e + dd7c5a1 commit 17d3a81
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 53 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
/build
/captures
/*/out
**/build/*
**/build/*
**/.externalNativeBuild
15 changes: 1 addition & 14 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
apply plugin: 'com.android.application'

defaultConfig.with {
applicationId = "com.zqc.opencc.android"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
}
android {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"

defaultConfig {
applicationId "com.zqc.opencc.android"
minSdkVersion 15
targetSdkVersion 27
}
}

android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}


repositories {
maven {
url 'https://dl.bintray.com/qichuan/maven/'
}
}

dependencies {
compile project(':lib-opencc-android')
compile 'com.android.support:appcompat-v7:23.2.0'
implementation project(':lib-opencc-android')
implementation 'com.android.support:appcompat-v7:27.1.1'
//compile 'com.zqc.opencc.android.lib:lib-opencc-android:0.8.0@aar'
}
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.6.0-beta6'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -16,6 +20,10 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
27 changes: 12 additions & 15 deletions lib-opencc-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.model.library'
apply plugin: 'com.android.library'

ext {
bintrayRepo = 'maven'
Expand All @@ -22,27 +22,24 @@ ext {
allLicenses = ["Apache-2.0"]
}

model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"

defaultConfig.with {
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 23
}
android {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"

ndk {
moduleName = "lib-opencc-android"
cppFlags.add("-fexceptions")
ldLibs.addAll(["atomic", "log", "android"])
stl = "c++_shared"
defaultConfig {
minSdkVersion 10
targetSdkVersion 27
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}

dependencies {
compile 'com.android.support:appcompat-v7:23.2.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ private static void copyFile(InputStream in, OutputStream out) throws IOExceptio

static {
System.loadLibrary("c++_shared");
System.loadLibrary("lib-opencc-android");
System.loadLibrary("opencc-android");
}
}
18 changes: 17 additions & 1 deletion lib-opencc-android/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
$(call import-module,third_party/googletest)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := opencc-android
LOCAL_LDLIBS += -latomic -llog -landroid

#traverse all the directory and subdirectory
define walk
$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e)))
endef

#find all the file recursively under jni/
ALLFILES = $(call walk, $(LOCAL_PATH))
FILE_LIST := $(filter %.cpp, $(ALLFILES))

LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)

include $(BUILD_SHARED_LIBRARY)
4 changes: 3 additions & 1 deletion lib-opencc-android/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
APP_ABI := all
APP_ABI := all
APP_STL := c++_shared
APP_CPPFLAGS := -fexceptions

0 comments on commit 17d3a81

Please sign in to comment.