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
======================


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM