android 混合rn开发,RN与android原生开发混合后的环境报错问题

RN与android原生开发混合后的环境报错问题

需要先安装nodejs

$ yarn --version

1.12.1

更新当前版本

yarn upgrade --latest

安装 | Yarn

https://yarnpkg.com/lang/zh-hans/docs/install/#windows-stable

================

到对应目录下用git bash here执行:

yarn

================

yarn start

npm install

================

rn混合后编译卡的问题,到D:\exchangespace目录下,cmd执行下面命令打包到D:\exchangespace\android\app\src\main\assets里面直接使用,只有rn的代码更新了才需要重新打包

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android\app\src\main\assets\index.android.bundle --assets-dest android\app\src\main\res\

=================

有时候构建Android studio项目,会莫名出现

error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.

Error:resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found的问题,并且还会引起一系列其他的问题。

修改方法:

将compileSdkVersion修改成25,并将对应的buildToolsVersion修改成25.0.2

=================

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')

compile 'com.facebook.react:react-native:+'

}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.facebook.react:react-native:+'

}

------------

compile --> implementation

testCompile --> testImplementation

testApi --> testImplementation

provided --> compileOnly

======================

不同严重程度可以按以下三种处理:

1.切换到project视图,删除.grade .idea 文件夹,clean project,

2.关闭android,重新打开编译

3.彻底清除缓存 File -> Invalidate Caches / Restart... (会清理掉本地修改的Gradle配置)

======================

Quit emulator

Quit Android Studio

Reopen Android Studio

Build > Clean Project

Run/debug your app onto your device/emulator again

======================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值