文学我不能在过去2周制作稳定的apk,这让我疯狂!
我已按照react-native-firebase
文档1:1
我的package.json:
{
"name": "MyApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"runiPhone5s": "react-native run-ios --simulator=\"iPhone 5s\""
},
"dependencies": {
"@exponent/react-native-action-sheet": "^0.2.1",
"@remobile/react-native-refresh-infinite-listview": "github:remobile/react-native-refresh-infinite-listview#pull/8/head",
"react": "16.0.0-alpha.12",
"react-mixin": "^2.0.2",
"react-native": "^0.48.3",
"react-native-barcode-scanner-universal": "^1.0.5",
"react-native-communications": "^2.1.0",
"react-native-deprecated-custom-components": "^0.1.1",
"react-native-fetch-blob": "git://github.com/wkh237/react-native-fetch-blob.git#b6c6f9a199e9530221f3b89fb7a219db324d0e83",
"react-native-firebase": "^2.0.4",
"react-native-gifted-listview": "github:faridsafi/react-native-gifted-listview#pull/51/head",
"react-native-loading-container": "^0.4.0",
"react-native-mail": "3.0.3",
"react-native-maps": "0.16.4",
"react-native-onesignal": "3.0.5",
"react-native-permissions": "1.0.0",
"react-native-share": "^1.0.13",
"superagent": "^3.1.0"
}
}
我的android/app/build.gradle
:
...
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.adpagesgo"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
...
dependencies {
compile "com.facebook.react:react-native:+" // From node_modules
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-share')
compile project(':react-native-mail')
//compile "com.android.support:appcompat-v7:23.0.1"
compile project(':react-native-onesignal')
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
exclude group: 'com.google.android.gms', module: 'play-services-analytics'
exclude group: 'com.google.android.gms', module: 'play-services-location'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}
compile "com.google.android.gms:play-services-base:11.0.0"
compile "com.google.android.gms:play-services-maps:11.0.0"
compile "com.google.android.gms:play-services-analytics:11.0.0"
compile "com.google.android.gms:play-services-location:11.0.0"
compile "com.google.android.gms:play-services-gcm:11.0.0"
compile(project(':react-native-firebase')) {
transitive = false
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
exclude group: 'com.google.android.gms', module: 'play-services-analytics'
exclude group: 'com.google.android.gms', module: 'play-services-location'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}
compile "com.google.firebase:firebase-core:11.2.0"
compile "com.google.firebase:firebase-analytics:11.2.0"
compile "com.google.firebase:firebase-crash:11.2.0"
compile project(':react-native-fetch-blob')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
My `android/build.gradle`:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "https://maven.google.com"
}
}
}
此时任何想法都会受到欢迎,如果它被包含和编译,怎么能找不到依赖...
答案 0 :(得分:0)
react-native-firebase
内的所有android/app/build.gradle
和google-play-services版本必须相同!
Android工作室提供了很好的提示。