【发布时间】:2018-12-28 20:48:23
【问题描述】:
我是 React Native 的新手。我正在学习导航,所以我从一个全新的 React Native 项目开始,并按照 React Navigation 网站 (react navigation doc) 上的步骤操作:
1) npm install --save react-navigation
2)npm install --save react-native-gesture-handler (not using expo)
3)react-native link react-native-gesture-handler
4) 修改MainActivity.java,如网站所说的Android
然后,当我运行命令react-native run-android 时,我在手机中看到了预期的应用程序,但出现以下消息:
配置项目:app 警告:配置“编译”已过时,已替换为“实施”和“API”。 它将在 2018 年底被删除。更多信息请参阅:http://d.android.com/r/tools/update-dependency-configurations.html
任务:react-native-gesture-handler:compileDebugJavaWithJavac 注意:/home/ana/code/react native/seeCompileError/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java 使用或覆盖已弃用的 API。 注意:使用 -Xlint:deprecation 重新编译以获取详细信息。 注意:某些输入文件使用未经检查或不安全的操作。 注意:重新编译时使用 -Xlint:unchecked for details。
我在 Linux Mint 19 上运行我的物理 Android 手机上的代码。
我的 build.gradle 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// 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"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
我的 package.json 文件:
{
"name": "seeCompileError",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"jwt-decode": "^2.2.0",
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-gesture-handler": "^1.0.12",
"react-navigation": "^3.0.9",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
如果有任何提示或帮助,我将不胜感激,谢谢。
【问题讨论】:
标签: android react-native react-navigation