正在显示
29 个修改的文件
包含
108 行增加
和
518 行删除
android/app/BUCK
已删除
100755 → 0
| 1 | -# To learn about Buck see [Docs](https://buckbuild.com/). | ||
| 2 | -# To run your application with Buck: | ||
| 3 | -# - install Buck | ||
| 4 | -# - `npm start` - to start the packager | ||
| 5 | -# - `cd android` | ||
| 6 | -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | ||
| 7 | -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | ||
| 8 | -# - `buck install -r android/app` - compile, install and run application | ||
| 9 | -# | ||
| 10 | - | ||
| 11 | -lib_deps = [] | ||
| 12 | - | ||
| 13 | -for jarfile in glob(['libs/*.jar']): | ||
| 14 | - name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] | ||
| 15 | - lib_deps.append(':' + name) | ||
| 16 | - prebuilt_jar( | ||
| 17 | - name = name, | ||
| 18 | - binary_jar = jarfile, | ||
| 19 | - ) | ||
| 20 | - | ||
| 21 | -for aarfile in glob(['libs/*.aar']): | ||
| 22 | - name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] | ||
| 23 | - lib_deps.append(':' + name) | ||
| 24 | - android_prebuilt_aar( | ||
| 25 | - name = name, | ||
| 26 | - aar = aarfile, | ||
| 27 | - ) | ||
| 28 | - | ||
| 29 | -android_library( | ||
| 30 | - name = "all-libs", | ||
| 31 | - exported_deps = lib_deps, | ||
| 32 | -) | ||
| 33 | - | ||
| 34 | -android_library( | ||
| 35 | - name = "app-code", | ||
| 36 | - srcs = glob([ | ||
| 37 | - "src/main/java/**/*.java", | ||
| 38 | - ]), | ||
| 39 | - deps = [ | ||
| 40 | - ":all-libs", | ||
| 41 | - ":build_config", | ||
| 42 | - ":res", | ||
| 43 | - ], | ||
| 44 | -) | ||
| 45 | - | ||
| 46 | -android_build_config( | ||
| 47 | - name = "build_config", | ||
| 48 | - package = "com.myreactdemo", | ||
| 49 | -) | ||
| 50 | - | ||
| 51 | -android_resource( | ||
| 52 | - name = "res", | ||
| 53 | - package = "com.myreactdemo", | ||
| 54 | - res = "src/main/res", | ||
| 55 | -) | ||
| 56 | - | ||
| 57 | -android_binary( | ||
| 58 | - name = "app", | ||
| 59 | - keystore = "//android/keystores:debug", | ||
| 60 | - manifest = "src/main/AndroidManifest.xml", | ||
| 61 | - package_type = "debug", | ||
| 62 | - deps = [ | ||
| 63 | - ":app-code", | ||
| 64 | - ], | ||
| 65 | -) |
android/app/build.gradle
已删除
100755 → 0
| 1 | -apply plugin: "com.android.application" | ||
| 2 | - | ||
| 3 | -import com.android.build.OutputFile | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets | ||
| 7 | - * and bundleReleaseJsAndAssets). | ||
| 8 | - * These basically call `react-native bundle` with the correct arguments during the Android build | ||
| 9 | - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the | ||
| 10 | - * bundle directly from the development server. Below you can see all the possible configurations | ||
| 11 | - * and their defaults. If you decide to add a configuration block, make sure to add it before the | ||
| 12 | - * `apply from: "../../node_modules/react-native/react.gradle"` line. | ||
| 13 | - * | ||
| 14 | - * project.ext.react = [ | ||
| 15 | - * // the name of the generated asset file containing your JS bundle | ||
| 16 | - * bundleAssetName: "index.android.bundle", | ||
| 17 | - * | ||
| 18 | - * // the entry file for bundle generation | ||
| 19 | - * entryFile: "index.android.js", | ||
| 20 | - * | ||
| 21 | - * // whether to bundle JS and assets in debug mode | ||
| 22 | - * bundleInDebug: false, | ||
| 23 | - * | ||
| 24 | - * // whether to bundle JS and assets in release mode | ||
| 25 | - * bundleInRelease: true, | ||
| 26 | - * | ||
| 27 | - * // whether to bundle JS and assets in another build variant (if configured). | ||
| 28 | - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants | ||
| 29 | - * // The configuration property can be in the following formats | ||
| 30 | - * // 'bundleIn${productFlavor}${buildType}' | ||
| 31 | - * // 'bundleIn${buildType}' | ||
| 32 | - * // bundleInFreeDebug: true, | ||
| 33 | - * // bundleInPaidRelease: true, | ||
| 34 | - * // bundleInBeta: true, | ||
| 35 | - * | ||
| 36 | - * // whether to disable dev mode in custom build variants (by default only disabled in release) | ||
| 37 | - * // for example: to disable dev mode in the staging build type (if configured) | ||
| 38 | - * devDisabledInStaging: true, | ||
| 39 | - * // The configuration property can be in the following formats | ||
| 40 | - * // 'devDisabledIn${productFlavor}${buildType}' | ||
| 41 | - * // 'devDisabledIn${buildType}' | ||
| 42 | - * | ||
| 43 | - * // the root of your project, i.e. where "package.json" lives | ||
| 44 | - * root: "../../", | ||
| 45 | - * | ||
| 46 | - * // where to put the JS bundle asset in debug mode | ||
| 47 | - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", | ||
| 48 | - * | ||
| 49 | - * // where to put the JS bundle asset in release mode | ||
| 50 | - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", | ||
| 51 | - * | ||
| 52 | - * // where to put drawable resources / React Native assets, e.g. the ones you use via | ||
| 53 | - * // require('./image.png')), in debug mode | ||
| 54 | - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", | ||
| 55 | - * | ||
| 56 | - * // where to put drawable resources / React Native assets, e.g. the ones you use via | ||
| 57 | - * // require('./image.png')), in release mode | ||
| 58 | - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", | ||
| 59 | - * | ||
| 60 | - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means | ||
| 61 | - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to | ||
| 62 | - * // date; if you have any other folders that you want to ignore for performance reasons (gradle | ||
| 63 | - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ | ||
| 64 | - * // for example, you might want to remove it from here. | ||
| 65 | - * inputExcludes: ["android/**", "ios/**"], | ||
| 66 | - * | ||
| 67 | - * // override which node gets called and with what additional arguments | ||
| 68 | - * nodeExecutableAndArgs: ["node"], | ||
| 69 | - * | ||
| 70 | - * // supply additional arguments to the packager | ||
| 71 | - * extraPackagerArgs: [] | ||
| 72 | - * ] | ||
| 73 | - */ | ||
| 74 | - | ||
| 75 | -project.ext.react = [ | ||
| 76 | - entryFile: "index.js" | ||
| 77 | -] | ||
| 78 | - | ||
| 79 | -apply from: "../../node_modules/react-native/react.gradle" | ||
| 80 | - | ||
| 81 | -/** | ||
| 82 | - * Set this to true to create two separate APKs instead of one: | ||
| 83 | - * - An APK that only works on ARM devices | ||
| 84 | - * - An APK that only works on x86 devices | ||
| 85 | - * The advantage is the size of the APK is reduced by about 4MB. | ||
| 86 | - * Upload all the APKs to the Play Store and people will download | ||
| 87 | - * the correct one based on the CPU architecture of their device. | ||
| 88 | - */ | ||
| 89 | -def enableSeparateBuildPerCPUArchitecture = false | ||
| 90 | - | ||
| 91 | -/** | ||
| 92 | - * Run Proguard to shrink the Java bytecode in release builds. | ||
| 93 | - */ | ||
| 94 | -def enableProguardInReleaseBuilds = false | ||
| 95 | - | ||
| 96 | -android { | ||
| 97 | - compileSdkVersion 23 | ||
| 98 | - buildToolsVersion "23.0.1" | ||
| 99 | - | ||
| 100 | - defaultConfig { | ||
| 101 | - applicationId "com.myreactdemo" | ||
| 102 | - minSdkVersion 16 | ||
| 103 | - targetSdkVersion 22 | ||
| 104 | - versionCode 1 | ||
| 105 | - versionName "1.0" | ||
| 106 | - ndk { | ||
| 107 | - abiFilters "armeabi-v7a", "x86" | ||
| 108 | - } | ||
| 109 | - } | ||
| 110 | - splits { | ||
| 111 | - abi { | ||
| 112 | - reset() | ||
| 113 | - enable enableSeparateBuildPerCPUArchitecture | ||
| 114 | - universalApk false // If true, also generate a universal APK | ||
| 115 | - include "armeabi-v7a", "x86" | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - buildTypes { | ||
| 119 | - release { | ||
| 120 | - minifyEnabled enableProguardInReleaseBuilds | ||
| 121 | - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||
| 122 | - } | ||
| 123 | - } | ||
| 124 | - // applicationVariants are e.g. debug, release | ||
| 125 | - applicationVariants.all { variant -> | ||
| 126 | - variant.outputs.each { output -> | ||
| 127 | - // For each separate APK per architecture, set a unique version code as described here: | ||
| 128 | - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits | ||
| 129 | - def versionCodes = ["armeabi-v7a":1, "x86":2] | ||
| 130 | - def abi = output.getFilter(OutputFile.ABI) | ||
| 131 | - if (abi != null) { // null for the universal-debug, universal-release variants | ||
| 132 | - output.versionCodeOverride = | ||
| 133 | - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode | ||
| 134 | - } | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | -} | ||
| 138 | - | ||
| 139 | -dependencies { | ||
| 140 | - compile fileTree(dir: "libs", include: ["*.jar"]) | ||
| 141 | - compile "com.android.support:appcompat-v7:23.0.1" | ||
| 142 | - compile "com.facebook.react:react-native:+" // From node_modules | ||
| 143 | -} | ||
| 144 | - | ||
| 145 | -// Run this once to be able to run the application with BUCK | ||
| 146 | -// puts all compile dependencies into folder libs for BUCK to use | ||
| 147 | -task copyDownloadableDepsToLibs(type: Copy) { | ||
| 148 | - from configurations.compile | ||
| 149 | - into 'libs' | ||
| 150 | -} |
android/app/proguard-rules.pro
已删除
100755 → 0
| 1 | -# Add project specific ProGuard rules here. | ||
| 2 | -# By default, the flags in this file are appended to flags specified | ||
| 3 | -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt | ||
| 4 | -# You can edit the include path and order by changing the proguardFiles | ||
| 5 | -# directive in build.gradle. | ||
| 6 | -# | ||
| 7 | -# For more details, see | ||
| 8 | -# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 9 | - | ||
| 10 | -# Add any project specific keep options here: | ||
| 11 | - | ||
| 12 | -# If your project uses WebView with JS, uncomment the following | ||
| 13 | -# and specify the fully qualified class name to the JavaScript interface | ||
| 14 | -# class: | ||
| 15 | -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 16 | -# public *; | ||
| 17 | -#} | ||
| 18 | - | ||
| 19 | -# Disabling obfuscation is useful if you collect stack traces from production crashes | ||
| 20 | -# (unless you are using a system that supports de-obfuscate the stack traces). | ||
| 21 | --dontobfuscate | ||
| 22 | - | ||
| 23 | -# React Native | ||
| 24 | - | ||
| 25 | -# Keep our interfaces so they can be used by other ProGuard rules. | ||
| 26 | -# See http://sourceforge.net/p/proguard/bugs/466/ | ||
| 27 | --keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip | ||
| 28 | --keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters | ||
| 29 | --keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip | ||
| 30 | - | ||
| 31 | -# Do not strip any method/class that is annotated with @DoNotStrip | ||
| 32 | --keep @com.facebook.proguard.annotations.DoNotStrip class * | ||
| 33 | --keep @com.facebook.common.internal.DoNotStrip class * | ||
| 34 | --keepclassmembers class * { | ||
| 35 | - @com.facebook.proguard.annotations.DoNotStrip *; | ||
| 36 | - @com.facebook.common.internal.DoNotStrip *; | ||
| 37 | -} | ||
| 38 | - | ||
| 39 | --keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { | ||
| 40 | - void set*(***); | ||
| 41 | - *** get*(); | ||
| 42 | -} | ||
| 43 | - | ||
| 44 | --keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } | ||
| 45 | --keep class * extends com.facebook.react.bridge.NativeModule { *; } | ||
| 46 | --keepclassmembers,includedescriptorclasses class * { native <methods>; } | ||
| 47 | --keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; } | ||
| 48 | --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; } | ||
| 49 | --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; } | ||
| 50 | - | ||
| 51 | --dontwarn com.facebook.react.** | ||
| 52 | - | ||
| 53 | -# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. | ||
| 54 | -# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. | ||
| 55 | --dontwarn android.text.StaticLayout | ||
| 56 | - | ||
| 57 | -# okhttp | ||
| 58 | - | ||
| 59 | --keepattributes Signature | ||
| 60 | --keepattributes *Annotation* | ||
| 61 | --keep class okhttp3.** { *; } | ||
| 62 | --keep interface okhttp3.** { *; } | ||
| 63 | --dontwarn okhttp3.** | ||
| 64 | - | ||
| 65 | -# okio | ||
| 66 | - | ||
| 67 | --keep class sun.misc.Unsafe { *; } | ||
| 68 | --dontwarn java.nio.file.* | ||
| 69 | --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement | ||
| 70 | --dontwarn okio.** |
android/app/src/main/AndroidManifest.xml
已删除
100755 → 0
| 1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | - package="com.myreactdemo" | ||
| 3 | - android:versionCode="1" | ||
| 4 | - android:versionName="1.0"> | ||
| 5 | - | ||
| 6 | - <uses-permission android:name="android.permission.INTERNET" /> | ||
| 7 | - <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
| 8 | - | ||
| 9 | - <uses-sdk | ||
| 10 | - android:minSdkVersion="16" | ||
| 11 | - android:targetSdkVersion="22" /> | ||
| 12 | - | ||
| 13 | - <application | ||
| 14 | - android:name=".MainApplication" | ||
| 15 | - android:allowBackup="true" | ||
| 16 | - android:label="@string/app_name" | ||
| 17 | - android:icon="@mipmap/ic_launcher" | ||
| 18 | - android:theme="@style/AppTheme"> | ||
| 19 | - <activity | ||
| 20 | - android:name=".MainActivity" | ||
| 21 | - android:label="@string/app_name" | ||
| 22 | - android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
| 23 | - android:windowSoftInputMode="adjustResize"> | ||
| 24 | - <intent-filter> | ||
| 25 | - <action android:name="android.intent.action.MAIN" /> | ||
| 26 | - <category android:name="android.intent.category.LAUNCHER" /> | ||
| 27 | - </intent-filter> | ||
| 28 | - </activity> | ||
| 29 | - <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | ||
| 30 | - | ||
| 31 | - <activity android:name=".MyActivity" | ||
| 32 | - android:configChanges="orientation"></activity> | ||
| 33 | - </application> | ||
| 34 | - | ||
| 35 | -</manifest> |
| 1 | -package com.myreactdemo; | ||
| 2 | - | ||
| 3 | -import com.facebook.react.ReactActivity; | ||
| 4 | - | ||
| 5 | -public class MainActivity extends ReactActivity { | ||
| 6 | - | ||
| 7 | - /** | ||
| 8 | - * Returns the name of the main component registered from JavaScript. | ||
| 9 | - * This is used to schedule rendering of the component. | ||
| 10 | - */ | ||
| 11 | - @Override | ||
| 12 | - protected String getMainComponentName() { | ||
| 13 | - return "MyReactDemo"; | ||
| 14 | - } | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -} |
| 1 | -package com.myreactdemo; | ||
| 2 | - | ||
| 3 | -import android.app.Application; | ||
| 4 | - | ||
| 5 | -import com.facebook.react.ReactApplication; | ||
| 6 | -import com.facebook.react.ReactNativeHost; | ||
| 7 | -import com.facebook.react.ReactPackage; | ||
| 8 | -import com.facebook.react.shell.MainReactPackage; | ||
| 9 | -import com.facebook.soloader.SoLoader; | ||
| 10 | - | ||
| 11 | -import java.util.Arrays; | ||
| 12 | -import java.util.List; | ||
| 13 | - | ||
| 14 | -public class MainApplication extends Application implements ReactApplication { | ||
| 15 | - | ||
| 16 | - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | ||
| 17 | - @Override | ||
| 18 | - public boolean getUseDeveloperSupport() { | ||
| 19 | - return BuildConfig.DEBUG; | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - @Override | ||
| 23 | - protected List<ReactPackage> getPackages() { | ||
| 24 | - return Arrays.<ReactPackage>asList( | ||
| 25 | - new MainReactPackage(), | ||
| 26 | - new MyReactPackage() | ||
| 27 | - ); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - @Override | ||
| 31 | - protected String getJSMainModuleName() { | ||
| 32 | - return "index.android"; | ||
| 33 | - } | ||
| 34 | - }; | ||
| 35 | - | ||
| 36 | - @Override | ||
| 37 | - public ReactNativeHost getReactNativeHost() { | ||
| 38 | - return mReactNativeHost; | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @Override | ||
| 42 | - public void onCreate() { | ||
| 43 | - super.onCreate(); | ||
| 44 | - SoLoader.init(this, /* native exopackage */ false); | ||
| 45 | - | ||
| 46 | - } | ||
| 47 | -} |
android/build.gradle
100755 → 100644
| 1 | -// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
| 2 | 1 | ||
| 3 | buildscript { | 2 | buildscript { |
| 4 | repositories { | 3 | repositories { |
| @@ -8,25 +7,38 @@ buildscript { | @@ -8,25 +7,38 @@ buildscript { | ||
| 8 | name 'Google' | 7 | name 'Google' |
| 9 | } | 8 | } |
| 10 | } | 9 | } |
| 11 | - dependencies { | ||
| 12 | - classpath 'com.android.tools.build:gradle:2.2.3' | ||
| 13 | 10 | ||
| 14 | - // NOTE: Do not place your application dependencies here; they belong | ||
| 15 | - // in the individual module build.gradle files | 11 | + dependencies { |
| 12 | + classpath 'com.android.tools.build:gradle:2.3.2' | ||
| 16 | } | 13 | } |
| 17 | } | 14 | } |
| 18 | 15 | ||
| 19 | -allprojects { | ||
| 20 | - repositories { | ||
| 21 | - mavenLocal() | ||
| 22 | - jcenter() | ||
| 23 | - maven { | ||
| 24 | - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
| 25 | - url "$rootDir/../node_modules/react-native/android" | 16 | +apply plugin: 'com.android.library' |
| 17 | + | ||
| 18 | +android { | ||
| 19 | + compileSdkVersion 23 | ||
| 20 | + | ||
| 21 | + defaultConfig { | ||
| 22 | + minSdkVersion 16 | ||
| 23 | + targetSdkVersion 22 | ||
| 24 | + buildToolsVersion "27.0.1" | ||
| 25 | + versionCode 1 | ||
| 26 | + versionName "1.0" | ||
| 26 | } | 27 | } |
| 28 | + lintOptions { | ||
| 29 | + abortOnError false | ||
| 30 | + } | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +repositories { | ||
| 34 | + mavenCentral() | ||
| 27 | maven { | 35 | maven { |
| 28 | url 'https://maven.google.com/' | 36 | url 'https://maven.google.com/' |
| 29 | name 'Google' | 37 | name 'Google' |
| 30 | } | 38 | } |
| 31 | - } | ||
| 32 | } | 39 | } |
| 40 | + | ||
| 41 | +dependencies { | ||
| 42 | + compile 'com.facebook.react:react-native:+' | ||
| 43 | +} | ||
| 44 | + |
android/gradle.properties
已删除
100755 → 0
| 1 | -# Project-wide Gradle settings. | ||
| 2 | - | ||
| 3 | -# IDE (e.g. Android Studio) users: | ||
| 4 | -# Gradle settings configured through the IDE *will override* | ||
| 5 | -# any settings specified in this file. | ||
| 6 | - | ||
| 7 | -# For more details on how to configure your build environment visit | ||
| 8 | -# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
| 9 | - | ||
| 10 | -# Specifies the JVM arguments used for the daemon process. | ||
| 11 | -# The setting is particularly useful for tweaking memory settings. | ||
| 12 | -# Default value: -Xmx10248m -XX:MaxPermSize=256m | ||
| 13 | -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
| 14 | - | ||
| 15 | -# When configured, Gradle will run in incubating parallel mode. | ||
| 16 | -# This option should only be used with decoupled projects. More details, visit | ||
| 17 | -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
| 18 | -# org.gradle.parallel=true | ||
| 19 | - | ||
| 20 | -android.useDeprecatedNdk=true |
android/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
不能预览此文件类型
android/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
| 1 | +#Thu Sep 24 09:14:14 CST 2020 | ||
| 1 | distributionBase=GRADLE_USER_HOME | 2 | distributionBase=GRADLE_USER_HOME |
| 2 | distributionPath=wrapper/dists | 3 | distributionPath=wrapper/dists |
| 3 | zipStoreBase=GRADLE_USER_HOME | 4 | zipStoreBase=GRADLE_USER_HOME |
| 4 | zipStorePath=wrapper/dists | 5 | zipStorePath=wrapper/dists |
| 5 | -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip | 6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip |
android/gradlew
100755 → 100644
| 1 | -#!/usr/bin/env bash | 1 | +#!/usr/bin/env sh |
| 2 | 2 | ||
| 3 | ############################################################################## | 3 | ############################################################################## |
| 4 | ## | 4 | ## |
| @@ -6,20 +6,38 @@ | @@ -6,20 +6,38 @@ | ||
| 6 | ## | 6 | ## |
| 7 | ############################################################################## | 7 | ############################################################################## |
| 8 | 8 | ||
| 9 | -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 10 | -DEFAULT_JVM_OPTS="" | 9 | +# Attempt to set APP_HOME |
| 10 | +# Resolve links: $0 may be a link | ||
| 11 | +PRG="$0" | ||
| 12 | +# Need this for relative symlinks. | ||
| 13 | +while [ -h "$PRG" ] ; do | ||
| 14 | + ls=`ls -ld "$PRG"` | ||
| 15 | + link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| 16 | + if expr "$link" : '/.*' > /dev/null; then | ||
| 17 | + PRG="$link" | ||
| 18 | + else | ||
| 19 | + PRG=`dirname "$PRG"`"/$link" | ||
| 20 | + fi | ||
| 21 | +done | ||
| 22 | +SAVED="`pwd`" | ||
| 23 | +cd "`dirname \"$PRG\"`/" >/dev/null | ||
| 24 | +APP_HOME="`pwd -P`" | ||
| 25 | +cd "$SAVED" >/dev/null | ||
| 11 | 26 | ||
| 12 | APP_NAME="Gradle" | 27 | APP_NAME="Gradle" |
| 13 | APP_BASE_NAME=`basename "$0"` | 28 | APP_BASE_NAME=`basename "$0"` |
| 14 | 29 | ||
| 30 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 31 | +DEFAULT_JVM_OPTS="" | ||
| 32 | + | ||
| 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. |
| 16 | MAX_FD="maximum" | 34 | MAX_FD="maximum" |
| 17 | 35 | ||
| 18 | -warn ( ) { | 36 | +warn () { |
| 19 | echo "$*" | 37 | echo "$*" |
| 20 | } | 38 | } |
| 21 | 39 | ||
| 22 | -die ( ) { | 40 | +die () { |
| 23 | echo | 41 | echo |
| 24 | echo "$*" | 42 | echo "$*" |
| 25 | echo | 43 | echo |
| @@ -30,6 +48,7 @@ die ( ) { | @@ -30,6 +48,7 @@ die ( ) { | ||
| 30 | cygwin=false | 48 | cygwin=false |
| 31 | msys=false | 49 | msys=false |
| 32 | darwin=false | 50 | darwin=false |
| 51 | +nonstop=false | ||
| 33 | case "`uname`" in | 52 | case "`uname`" in |
| 34 | CYGWIN* ) | 53 | CYGWIN* ) |
| 35 | cygwin=true | 54 | cygwin=true |
| @@ -40,31 +59,11 @@ case "`uname`" in | @@ -40,31 +59,11 @@ case "`uname`" in | ||
| 40 | MINGW* ) | 59 | MINGW* ) |
| 41 | msys=true | 60 | msys=true |
| 42 | ;; | 61 | ;; |
| 62 | + NONSTOP* ) | ||
| 63 | + nonstop=true | ||
| 64 | + ;; | ||
| 43 | esac | 65 | esac |
| 44 | 66 | ||
| 45 | -# For Cygwin, ensure paths are in UNIX format before anything is touched. | ||
| 46 | -if $cygwin ; then | ||
| 47 | - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
| 48 | -fi | ||
| 49 | - | ||
| 50 | -# Attempt to set APP_HOME | ||
| 51 | -# Resolve links: $0 may be a link | ||
| 52 | -PRG="$0" | ||
| 53 | -# Need this for relative symlinks. | ||
| 54 | -while [ -h "$PRG" ] ; do | ||
| 55 | - ls=`ls -ld "$PRG"` | ||
| 56 | - link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| 57 | - if expr "$link" : '/.*' > /dev/null; then | ||
| 58 | - PRG="$link" | ||
| 59 | - else | ||
| 60 | - PRG=`dirname "$PRG"`"/$link" | ||
| 61 | - fi | ||
| 62 | -done | ||
| 63 | -SAVED="`pwd`" | ||
| 64 | -cd "`dirname \"$PRG\"`/" >&- | ||
| 65 | -APP_HOME="`pwd -P`" | ||
| 66 | -cd "$SAVED" >&- | ||
| 67 | - | ||
| 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar |
| 69 | 68 | ||
| 70 | # Determine the Java command to use to start the JVM. | 69 | # Determine the Java command to use to start the JVM. |
| @@ -90,7 +89,7 @@ location of your Java installation." | @@ -90,7 +89,7 @@ location of your Java installation." | ||
| 90 | fi | 89 | fi |
| 91 | 90 | ||
| 92 | # Increase the maximum file descriptors if we can. | 91 | # Increase the maximum file descriptors if we can. |
| 93 | -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then | 92 | +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then |
| 94 | MAX_FD_LIMIT=`ulimit -H -n` | 93 | MAX_FD_LIMIT=`ulimit -H -n` |
| 95 | if [ $? -eq 0 ] ; then | 94 | if [ $? -eq 0 ] ; then |
| 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then |
| @@ -114,6 +113,7 @@ fi | @@ -114,6 +113,7 @@ fi | ||
| 114 | if $cygwin ; then | 113 | if $cygwin ; then |
| 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` | 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
| 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` |
| 116 | + JAVACMD=`cygpath --unix "$JAVACMD"` | ||
| 117 | 117 | ||
| 118 | # We build the pattern for arguments to be converted via cygpath | 118 | # We build the pattern for arguments to be converted via cygpath |
| 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` |
| @@ -154,11 +154,19 @@ if $cygwin ; then | @@ -154,11 +154,19 @@ if $cygwin ; then | ||
| 154 | esac | 154 | esac |
| 155 | fi | 155 | fi |
| 156 | 156 | ||
| 157 | -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules | ||
| 158 | -function splitJvmOpts() { | ||
| 159 | - JVM_OPTS=("$@") | 157 | +# Escape application args |
| 158 | +save () { | ||
| 159 | + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | ||
| 160 | + echo " " | ||
| 160 | } | 161 | } |
| 161 | -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS | ||
| 162 | -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" | 162 | +APP_ARGS=$(save "$@") |
| 163 | + | ||
| 164 | +# Collect all arguments for the java command, following the shell quoting and substitution rules | ||
| 165 | +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | ||
| 166 | + | ||
| 167 | +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | ||
| 168 | +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | ||
| 169 | + cd "$(dirname "$0")" | ||
| 170 | +fi | ||
| 163 | 171 | ||
| 164 | -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" | 172 | +exec "$JAVACMD" "$@" |
android/gradlew.bat
100755 → 100644
| @@ -8,14 +8,14 @@ | @@ -8,14 +8,14 @@ | ||
| 8 | @rem Set local scope for the variables with windows NT shell | 8 | @rem Set local scope for the variables with windows NT shell |
| 9 | if "%OS%"=="Windows_NT" setlocal | 9 | if "%OS%"=="Windows_NT" setlocal |
| 10 | 10 | ||
| 11 | -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 12 | -set DEFAULT_JVM_OPTS= | ||
| 13 | - | ||
| 14 | set DIRNAME=%~dp0 | 11 | set DIRNAME=%~dp0 |
| 15 | if "%DIRNAME%" == "" set DIRNAME=. | 12 | if "%DIRNAME%" == "" set DIRNAME=. |
| 16 | set APP_BASE_NAME=%~n0 | 13 | set APP_BASE_NAME=%~n0 |
| 17 | set APP_HOME=%DIRNAME% | 14 | set APP_HOME=%DIRNAME% |
| 18 | 15 | ||
| 16 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 17 | +set DEFAULT_JVM_OPTS= | ||
| 18 | + | ||
| 19 | @rem Find java.exe | 19 | @rem Find java.exe |
| 20 | if defined JAVA_HOME goto findJavaFromJavaHome | 20 | if defined JAVA_HOME goto findJavaFromJavaHome |
| 21 | 21 | ||
| @@ -46,10 +46,9 @@ echo location of your Java installation. | @@ -46,10 +46,9 @@ echo location of your Java installation. | ||
| 46 | goto fail | 46 | goto fail |
| 47 | 47 | ||
| 48 | :init | 48 | :init |
| 49 | -@rem Get command-line arguments, handling Windowz variants | 49 | +@rem Get command-line arguments, handling Windows variants |
| 50 | 50 | ||
| 51 | if not "%OS%" == "Windows_NT" goto win9xME_args | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args |
| 52 | -if "%@eval[2+2]" == "4" goto 4NT_args | ||
| 53 | 52 | ||
| 54 | :win9xME_args | 53 | :win9xME_args |
| 55 | @rem Slurp the command line arguments. | 54 | @rem Slurp the command line arguments. |
| @@ -60,11 +59,6 @@ set _SKIP=2 | @@ -60,11 +59,6 @@ set _SKIP=2 | ||
| 60 | if "x%~1" == "x" goto execute | 59 | if "x%~1" == "x" goto execute |
| 61 | 60 | ||
| 62 | set CMD_LINE_ARGS=%* | 61 | set CMD_LINE_ARGS=%* |
| 63 | -goto execute | ||
| 64 | - | ||
| 65 | -:4NT_args | ||
| 66 | -@rem Get arguments from the 4NT Shell from JP Software | ||
| 67 | -set CMD_LINE_ARGS=%$ | ||
| 68 | 62 | ||
| 69 | :execute | 63 | :execute |
| 70 | @rem Setup the command line | 64 | @rem Setup the command line |
android/keystores/BUCK
已删除
100755 → 0
android/settings.gradle
已删除
100755 → 0
android/src/main/AndroidManifest.xml
0 → 100644
android/app/src/main/java/com/myreactdemo/MyActivity.java
→
android/src/main/java/com/reactlibrary/MyActivity.java
100755 → 100644
| 1 | -package com.myreactdemo; | 1 | +package com.reactlibrary; |
| 2 | 2 | ||
| 3 | -import android.app.Activity; | ||
| 4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | +import android.app.Activity; | ||
| 5 | import android.view.Gravity; | 5 | import android.view.Gravity; |
| 6 | import android.view.View; | 6 | import android.view.View; |
| 7 | import android.view.ViewGroup; | 7 | import android.view.ViewGroup; |
| @@ -11,16 +11,10 @@ import android.widget.RelativeLayout; | @@ -11,16 +11,10 @@ import android.widget.RelativeLayout; | ||
| 11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 12 | import android.widget.Toast; | 12 | import android.widget.Toast; |
| 13 | import android.content.Intent; | 13 | import android.content.Intent; |
| 14 | -import com.myreactdemo.util.ThemeUtile; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * 1、 原生页面与RN 跳转交互 | ||
| 18 | - * 2、 黑白主题切换 | ||
| 19 | - */ | 14 | +import com.reactlibrary.util.ThemeUtile; |
| 20 | 15 | ||
| 21 | public class MyActivity extends Activity implements View.OnClickListener { | 16 | public class MyActivity extends Activity implements View.OnClickListener { |
| 22 | 17 | ||
| 23 | - | ||
| 24 | @Override | 18 | @Override |
| 25 | protected void onCreate(Bundle savedInstanceState) { | 19 | protected void onCreate(Bundle savedInstanceState) { |
| 26 | super.onCreate(savedInstanceState); | 20 | super.onCreate(savedInstanceState); |
| @@ -87,5 +81,3 @@ public class MyActivity extends Activity implements View.OnClickListener { | @@ -87,5 +81,3 @@ public class MyActivity extends Activity implements View.OnClickListener { | ||
| 87 | */ | 81 | */ |
| 88 | } | 82 | } |
| 89 | } | 83 | } |
| 90 | - | ||
| 91 | - |
android/app/src/main/java/com/myreactdemo/MyIntentModule.java
→
android/src/main/java/com/reactlibrary/RNVodeAdModule.java
100755 → 100644
| 1 | -package com.myreactdemo; | ||
| 2 | 1 | ||
| 2 | +package com.reactlibrary; | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
| 6 | 6 | ||
| 7 | -import com.facebook.react.bridge.Callback; | ||
| 8 | -import com.facebook.react.bridge.JSApplicationIllegalArgumentException; | ||
| 9 | -import com.facebook.react.bridge.ReactApplicationContext; | ||
| 10 | import com.facebook.react.bridge.ReactContextBaseJavaModule; | 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; |
| 11 | import com.facebook.react.bridge.ReactMethod; | 8 | import com.facebook.react.bridge.ReactMethod; |
| 9 | +import com.facebook.react.bridge.JSApplicationIllegalArgumentException; | ||
| 10 | +import com.facebook.react.bridge.ReactApplicationContext; | ||
| 11 | +import com.facebook.react.bridge.Callback; | ||
| 12 | 12 | ||
| 13 | -/** | ||
| 14 | - * 原生Activity与React交互——模块 | ||
| 15 | - */ | 13 | +public class RNVodeAdModule extends ReactContextBaseJavaModule { |
| 16 | 14 | ||
| 17 | -public class MyIntentModule extends ReactContextBaseJavaModule { | 15 | + private final ReactApplicationContext reactContext; |
| 18 | 16 | ||
| 19 | - public MyIntentModule(ReactApplicationContext reactContext) { | 17 | + public RNVodeAdModule(ReactApplicationContext reactContext) { |
| 20 | super(reactContext); | 18 | super(reactContext); |
| 19 | + this.reactContext = reactContext; | ||
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | @Override | 22 | @Override |
| 24 | public String getName() { | 23 | public String getName() { |
| 25 | return "IntentMoudle"; | 24 | return "IntentMoudle"; |
| 26 | } | 25 | } |
| 27 | - //注意:记住getName方法中的命名名称,JS中调用需要 | ||
| 28 | 26 | ||
| 29 | @ReactMethod | 27 | @ReactMethod |
| 30 | public void gotoNative( String params){ | 28 | public void gotoNative( String params){ |
| @@ -32,7 +30,7 @@ public class MyIntentModule extends ReactContextBaseJavaModule { | @@ -32,7 +30,7 @@ public class MyIntentModule extends ReactContextBaseJavaModule { | ||
| 32 | 30 | ||
| 33 | Activity currentActivity = getCurrentActivity(); | 31 | Activity currentActivity = getCurrentActivity(); |
| 34 | if(null!=currentActivity){ | 32 | if(null!=currentActivity){ |
| 35 | - Class toActivity = Class.forName("com.myreactdemo.MyActivity"); | 33 | + Class toActivity = Class.forName("com.reactlibrary.MyActivity"); |
| 36 | Intent intent = new Intent(currentActivity,toActivity); | 34 | Intent intent = new Intent(currentActivity,toActivity); |
| 37 | intent.putExtra("params", params); | 35 | intent.putExtra("params", params); |
| 38 | currentActivity.startActivity(intent); | 36 | currentActivity.startActivity(intent); |
| @@ -72,5 +70,4 @@ public class MyIntentModule extends ReactContextBaseJavaModule { | @@ -72,5 +70,4 @@ public class MyIntentModule extends ReactContextBaseJavaModule { | ||
| 72 | "不能返回js : "+e.getMessage()); | 70 | "不能返回js : "+e.getMessage()); |
| 73 | } | 71 | } |
| 74 | } | 72 | } |
| 75 | -//注意:startActivityFromJS、dataToJS方法添加RN注解(@ReactMethod),否则该方法将不被添加到RN中 | ||
| 76 | } | 73 | } |
android/app/src/main/java/com/myreactdemo/MyReactPackage.java
→
android/src/main/java/com/reactlibrary/RNVodeAdPackage.java
100755 → 100644
| 1 | -package com.myreactdemo; | ||
| 2 | 1 | ||
| 3 | -import com.facebook.react.ReactPackage; | ||
| 4 | -import com.facebook.react.bridge.NativeModule; | ||
| 5 | -import com.facebook.react.bridge.ReactApplicationContext; | ||
| 6 | -import com.facebook.react.uimanager.ViewManager; | 2 | +package com.reactlibrary; |
| 7 | 3 | ||
| 8 | import java.util.Arrays; | 4 | import java.util.Arrays; |
| 9 | import java.util.Collections; | 5 | import java.util.Collections; |
| 10 | import java.util.List; | 6 | import java.util.List; |
| 11 | 7 | ||
| 12 | -/** | ||
| 13 | - * 注册模块 | ||
| 14 | - */ | ||
| 15 | - | ||
| 16 | -public class MyReactPackage implements ReactPackage { | 8 | +import com.facebook.react.ReactPackage; |
| 9 | +import com.facebook.react.bridge.NativeModule; | ||
| 10 | +import com.facebook.react.bridge.ReactApplicationContext; | ||
| 11 | +import com.facebook.react.uimanager.ViewManager; | ||
| 12 | +import com.facebook.react.bridge.JavaScriptModule; | ||
| 13 | +public class RNVodeAdPackage implements ReactPackage { | ||
| 17 | @Override | 14 | @Override |
| 18 | public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | 15 | public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { |
| 19 | - return Arrays.<NativeModule>asList(new MyIntentModule(reactContext)); | 16 | + return Arrays.<NativeModule>asList(new RNVodeAdModule(reactContext)); |
| 17 | + } | ||
| 18 | + | ||
| 19 | + // Deprecated from RN 0.47 | ||
| 20 | + public List<Class<? extends JavaScriptModule>> createJSModules() { | ||
| 21 | + return Collections.emptyList(); | ||
| 20 | } | 22 | } |
| 23 | + | ||
| 21 | @Override | 24 | @Override |
| 22 | public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | 25 | public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { |
| 23 | return Collections.emptyList(); | 26 | return Collections.emptyList(); |
-
请 注册 或 登录 后发表评论