add android sample gradle support #886

Closed
gengjiawen wants to merge 1 commits from android_sample into main
32 changed files with 39 additions and 13 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
.idea/
*.iml
local.properties
.DS_STORE
/buck-cache/

View File

@@ -10,7 +10,7 @@ load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID_RES_TARGET", "ANDROID_SAMP
yoga_android_binary(
name = "sample",
keystore = ":debug_keystore",
manifest = "AndroidManifest.xml",
manifest = "src/main/AndroidManifest.xml",
deps = [
ANDROID_SAMPLE_JAVA_TARGET,
ANDROID_SAMPLE_RES_TARGET,

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.facebook.samples.yoga"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
}
compileOptions {
targetCompatibility rootProject.targetCompatibilityVersion
sourceCompatibility rootProject.sourceCompatibilityVersion
}
}
dependencies {
implementation project(':yoga-layout')
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.facebook.soloader:soloader:0.6.0"
}

View File

@@ -14,14 +14,6 @@
android:versionName="1.0"
>
<variable name="applicationId" value="com.facebook.yoga"/>
<variable name="app_label" value="Yoga Sample App"/>
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19"
/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -14,7 +14,7 @@ buildscript {
maven { url 'https://maven.google.com/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
@@ -33,8 +33,8 @@ allprojects {
ext {
minSdkVersion = 14
targetSdkVersion = 25
compileSdkVersion = 26
buildToolsVersion = '26.0.2'
compileSdkVersion = 28
buildToolsVersion = '28.0.3'
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7
}

View File

@@ -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-4.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

View File

@@ -6,6 +6,7 @@
*/
include ':yoga', ':yogacore', ':yoga-layout', ':yoga:proguard-annotations', ':libfb'
include ':android:sample'
Mishkun commented 2019-05-07 08:23:40 -07:00 (Migrated from github.com)
Review
include ':yoga-layout:sample'

Or else it fails to sync with the message

ERROR: The modules ['android', 'yoga-layout'] point to the same directory in the file system.
Each module must have a unique path.

because when using relative project naming you implicitly declare an 'android' project

```suggestion include ':yoga-layout:sample' ``` Or else it fails to sync with the message ``` ERROR: The modules ['android', 'yoga-layout'] point to the same directory in the file system. Each module must have a unique path. ``` because when using relative project naming you implicitly declare an 'android' project
gengjiawen commented 2019-05-07 08:27:13 -07:00 (Migrated from github.com)
Review

I don't see the error neither on windows nor on macOS.

I don't see the error neither on windows nor on macOS.
project(':yoga').projectDir = file('java')
project(':yoga:proguard-annotations').projectDir = file('java/proguard-annotations')
project(':yoga-layout').projectDir = file('android')