rn一些知识点

最近配合前端开发rn,下面是一些常用的命令及错误。不足之处多见谅

1,常用命令

(1)创建npm,每个项目都需要此命令:npm install

(2)启动rn
react-native run-android
(3)adb掉了:也就是显示8080.   adb reverse tcp:8081 tcp:8081
(4)react-native log-android        打印log
(5)打包:进入安卓所在的目录: gradlew assembleRelease

2,如果rn的版本是2.3.3,as是3.0。在下面
(1)E:\WorkNotes\flyAndroid\android\gradle.properties里面添加
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
(2)E:\WorkNotes\flyAndroid\android\build.gradle里面添加参数
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}


allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
url 'https://maven.google.com'
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}


3,版本过高的问题
A problem occurred configuring project ':react-native-linear-gradient'.
> Could not resolve all files for configuration ':react-native-linear-gradient:c
lasspath'.
   > Could not find com.android.tools.build:gradle:3.0.0.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle
-3.0.0.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle
-3.0.0.jar
     Required by:
         project :react-native-linear-gradient


方法:react-native-linar-gradient里面的build.gradle
版本改一下。


4,打包错误
Error:Execution failed for task ':app:transformDexWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
compile 'com.android.support:multidex:1.0.1'

defaultConfig {
   ...
    multiDexEnabled true

compile 'com.android.support:multidex:1.0.1'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值