谢谢。最近好热,大家夏天快乐~早日成为技术大牛
希望一起学习,互相进步 ^ ^
老规矩,先上图
注意版本匹配问题package.json
"dependencies": {
"install": "^0.10.1",
"react": "^16.0.0-alpha.12",
"react-native": "^0.46.1"
}
之前一直load不出来好急,最后决定更新版本
终于搞定
前提:node环境git环境
(以window为例)
1:新建安卓工程
2:选择sdk版本 一定要 参考官方文档http://facebook.github.io/react-native/docs/getting-started.html
sdk - plateforms
sdk - tools
接下来点击next - >就好了
3:进入项目,修改bulid
compileSdkVersion 23
compile ‘com.android.support:appcompat-v7:23.0.1’
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.gmz.myreact"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
4:andoridstudio 的Terminal终端 使用命令行导入react 和 react-native包
npm init
生成package.json文件
package.json文件是npm下载模块Module时会带有这个json文件 里面