我正在尝试为Android实现React本机MapView
。我确实遵循了github安装说明,但当我尝试使用React-native run-android
命令运行时,遇到了编译错误。
任务:React-Native-Maps:CompileDebugrenderScript失败
>
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获得完整的见解。
请访问https://help.gradle.org获取更多帮助
5S 8可操作任务中的构建失败:8执行错误无法在设备上安装应用程序,请阅读上面的错误以了解详细信息。确保运行了Android模拟器或连接了设备并设置了Android开发环境:https://facebook.github.io/react-native/docs/gett-started.html错误命令失败:gradlew.bat app:installdebug
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.mapviewdemo"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86-64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86-64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-maps')
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(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:28.0.0'
force 'com.android.support:appcompat-v7:28.0.0'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
{
"name": "MapViewDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.0",
"react-native-maps": "^0.23.0"
},
"devDependencies": {
"@babel/core": "7.3.4",
"@babel/runtime": "7.3.4",
"babel-jest": "24.5.0",
"jest": "24.5.0",
"metro-react-native-babel-preset": "0.53.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
经过两天的努力,我自己找到了解决方案。真正的问题是我的项目使用了compilesdkversion=28
,而react-native-maps
node_module使用了不同版本的compilesdkversion
。
要解决这个问题,需要更新react-native-maps
node_modulecompilesdkversion
版本。
project_name>node_modules>react-native-maps>lib>android>build.gradle
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
模块编译SDK版本和支持库版本应与项目编译SDK版本和支持库版本相同。
获取人工误差 C:\users\projectname\node_modules\react-native-reanimated\android\src\main\java\com\swhundues\reanimated\nodesManager.java:171:错误:找不到符号new GuardedRunnable(mcontext.getExceptionHandler()){^symbo
错误,无法安装应用程序。确保您已经设置了Android开发环境:https://reactnative.dev/docs/environment-setup。运行带有--verbose标志的CLI以获得更多详细信息。错误:命令失败:./gradlew app:installdebug-preactnativedevserverport=8081 失败:生成失败,出现异常。 在6s中生成失败 MY
问题内容: 我通过世博会创建了该应用程序。我通过应用程序加载程序上传了ipa,但下面的消息被拒绝了。问题是什么? 该捆绑软件无效-/Payload/ExpoKitApp.app/FacebookSDKStrings.bundle的Info.plist文件丢失或无法读取。 无效的捆绑软件-“ /Payload/ExpoKitApp.app/FacebookSDKStrings.bundle”中的捆绑
我需要使用react-native-scrollable-tab-view,同时,我还在这个链接后面安装了/setup react-native-viewpager。这个错误突然出现了,目前,我仍然找不到解决它的方法。我希望有人已经遇到了,并帮助我。我在1周前才开始使用React Native,但这个项目已经存在一年多了,所以并不是所有的依赖项都更新了,包括react-native,它的版本是0.
命令失败:/usr/libexec/plistbuddy-c print:cfbundleidentifier build/build/products/debug-iphonesimulator/reactdemonavigation.app/info.plist print:条目“:cfbundleidentifier”不存在
我的项目中出现了以下错误:`Failure:生成失败,出现异常。 > 其中:设置文件'/home/kaizar/music/oreo-fashion-v2.3.0/app/rn_oreo/android/Settings.gradle'行:4 错误:评估设置“rn_oreo”时出现问题。 请访问https://help.gradle.org获取更多帮助