Skip to content

Commit

Permalink
Merge pull request android#274 from googlesamples/san-angeles-cmake-fix
Browse files Browse the repository at this point in the history
Fix sample san-angeles for:
  • Loading branch information
ggfan authored Aug 5, 2016
2 parents 5526ecd + 10bfd27 commit 6fbed51
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ build
*~
.DS_Store
externalNativeBuild
.externalNativeBuild

6 changes: 4 additions & 2 deletions san-angeles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ San Angeles
===========
San Angeles is an Android port of a demo that uses GLES C/API to render a procedural scene.

See the original [README](app/src/main/jni/README.txt) for more details about the original GLES port.
See the original [README](app/src/main/cpp/README.txt) for more details about the original GLES port.

This sample uses the new [Gradle Experimental Android plugin](http://tools.android.com/tech-docs/new-build-system/gradle-experimental) with C++ support.
The sample demos:
- [Android Studio with CMake support](http://tools.android.com/tech-docs/external-c-builds)
- [ABI APK split](http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits#TOC-ABIs-Splits)

Pre-requisites
--------------
Expand Down
34 changes: 27 additions & 7 deletions san-angeles/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// To demo apk split feature as documented at
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits#TOC-ABIs-Splits
apply plugin: 'com.android.application'

import com.android.build.OutputFile
ext.versionCodes = ['armeabi-v7a':1, 'arm64-v8a':2, 'mips':3, 'x86':4]

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'

defaultConfig.with {
defaultConfig {
applicationId 'com.example.SanAngeles'
minSdkVersion 4
targetSdkVersion 23
externalNativeBuild {
cmake {
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
}
}
versionCode 1
versionName "1.0"
}
buildTypes {
release {
Expand All @@ -24,7 +26,25 @@ android {
cmake {
// platformVersion 9
// toolchain 'clang'
path 'src/main/cpp'
path 'src/main/cpp/CMakeLists.txt'
}
}
splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a','mips', 'x86'
universalApk false
}
}

applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000000 +
defaultConfig.versionCode
}
}
}

4 changes: 1 addition & 3 deletions san-angeles/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.SanAngeles"
android:versionCode="1"
android:versionName="1.0">
package="com.example.SanAngeles">
<application
android:allowBackup="false"
android:fullBackupContent="false"
Expand Down
2 changes: 1 addition & 1 deletion san-angeles/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha5'
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
}
}

Expand Down
4 changes: 2 additions & 2 deletions san-angeles/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Thu Aug 04 21:19:31 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

0 comments on commit 6fbed51

Please sign in to comment.