Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新android编译版本 #167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,24 @@ android {
}
}
}
packagingOptions {
//当项目中出现多个同名的so文件会编译异常,过滤多余的so文件
pickFirst '**/libfbjni.so'
pickFirst '**/libc++_shared.so'
pickFirst '**/libjsc.so'
}
}

dependencies {
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-music-control')
implementation project(':react-native-vector-icons')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-video')
implementation project(path: ':@react-native-community_async-storage')
implementation project(path: ':react-native-music-control')
implementation project(path: ':react-native-vector-icons')
implementation project(path: ':react-native-gesture-handler')
implementation project(path: ':react-native-video')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "org.webkit:android-jsc:+"
}

// Run this once to be able to run the application with BUCK
Expand Down
23 changes: 21 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@

buildscript {
ext {
//在导入的项目中,如:react-native-music-control中有safeExtGet获取版本号
//以下代码用于统一项目编译版本
buildToolsVersion = "28.0.3"
minSdkVersion = 16
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
set('compileSdkVersion', compileSdkVersion)
set('buildToolsVersion', buildToolsVersion)
set('minSdkVersion', minSdkVersion)
set('targetSdkVersion', targetSdkVersion)
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.0")
classpath "com.android.tools.build:gradle:3.4.3"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
def REACT_NATIVE_VERSION = new File(['node', '--print', "JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
repositories {
Expand All @@ -29,5 +36,17 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
}
configurations.all {
//低于0.65版本的‘react-native’需要加上这段代码,
//否则会出现类似:程序包com.facebook.react.common不存在 的错误
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
}