• 编译React Native出现如下报错: Failed to apply plugin [id ‘com.android.application’] Gradle version 2.2 is required. Current version is 2.10 If using the gradle wrapper, try editing the ...
    • 编译React Native出现如下报错:

    Failed to apply plugin [id ‘com.android.application’]
    Gradle version 2.2 is required. Current version is 2.10 If using the gradle wrapper, try editing the distributionUrl in xxxxxxxxx

    • 不认识英文,只知道大概意思就是Gradle当前版本和要求的版本不一致,让我找到对应的路径文件进行修改 (就是最后面xxxxx 每个人不一样根据项目存放路径)

      项目./android/gradle/wrapper/gradle-wrapper.properties

    • 改成了对应的版本后突然发现2.2版本的下载失败或者下不动的情况.

    解决办法:

    1. 失败了后接着尝试下载 (每个人都知道的,我说的是废话)
    2. 也就是我尝试后成功了办法,不走寻常路,哎,你叫我改成2.2我就改啊,太没面子了.

      一. 项目./android/gradle/wrapper/gradle-wrapper.properties 路径下的文件改成如下

      distributionBase=GRADLE_USER_HOME
      distributionPath=wrapper/dists
      zipStoreBase=GRADLE_USER_HOME
      zipStorePath=wrapper/dists
      distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip

    直接改成2.14.1版本 最新的.

    让后接着编译发现还是报错.

    二. 找到 项目./adnroid/build.gradle文件,改成如下:

    dependencies {
    classpath ‘com.android.tools.build:gradle:2.2.3’
    }

    接着再次编译通过了.

    收工

    展开全文
  • Manifest merger failed —— Androidx 中间尝试了很多方式,比如 manifest/application中添加 android:appComponentFactory="" tools:replace="android:appComponentFactory" 或者 错误展示 ...

    Manifest merger failed —— Androidx

    中间尝试了很多方式,都不行!比如

    manifest/application中添加
    android:appComponentFactory="" tools:replace="android:appComponentFactory"

    或者

    gradle.properties中写入
    android.useAndroidX=true android.enableJetifier=true

    错误展示

    在这里插入图片描述

    • What went wrong:
      Execution failed for task ‘:app:processDebugManifest’.
      Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
      is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
      Suggestion: add ‘tools:replace=“android:appComponentFactory”’ to element at AndroidManifest.xml:7:5-117 to override.

    昨天项目好好的,今个一大早运行编译就报错!!
    游遍整个 Internet 发现,竟然和 AndroidX 有毛关系!!!

    定位错误原因

    错误的原因: Androidx之前的安卓support库已经存在当前最新的Androidx support库中,他俩不能共存。而事实是共存了,因此编译时候就导致资源合并异常!
    到底是怎么共存的?反正我在android/app的gradle中是没有引入。很容易猜想到libraries —— 引入的第三方库。是的!!

    确定解决方案

    接下来的解决思路是,怎么去查哪个库引入了Androidx的东西??然后去掉对Androidx的引用(去掉方式就是使用那个没引用Androidx的版本)

    查看哪些库依赖了Androidx,在android目录下执行命令
    cd android/ && ./gradlew :app:dependenciess

    下面看下我的(翻到最后一个~)

    releaseUnitTestRuntimeClasspath - Resolved configuration for runtime for variant: releaseUnitTest
    +--- project :react-native-fast-image
    |    +--- com.facebook.react:react-native:+ -> 0.59.9
    |    |    +--- com.facebook.infer.annotation:infer-annotation:0.11.2
    |    |    |    \--- com.google.code.findbugs:jsr305:3.0.1 -> 3.0.2
    |    |    +--- javax.inject:javax.inject:1
    |    |    +--- com.android.support:appcompat-v7:28.0.0
    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    +--- com.android.support:support-compat:28.0.0
    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    +--- com.android.support:collections:28.0.0
    |    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
    |    |    |    |    +--- android.arch.lifecycle:runtime:1.1.1
    |    |    |    |    |    +--- android.arch.lifecycle:common:1.1.1
    |    |    |    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
    |    |    |    |    |    +--- android.arch.core:common:1.1.1
    |    |    |    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
    |    |    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
    |    |    |    |    \--- com.android.support:versionedparcelable:28.0.0
    |    |    |    |         +--- com.android.support:support-annotations:28.0.0
    |    |    |    |         \--- com.android.support:collections:28.0.0 (*)
    |    |    |    +--- com.android.support:collections:28.0.0 (*)
    |    |    |    +--- com.android.support:cursoradapter:28.0.0
    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
    |    |    |    +--- com.android.support:support-core-utils:28.0.0
    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    +--- com.android.support:documentfile:28.0.0
    |    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
    |    |    |    |    +--- com.android.support:loader:28.0.0
    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    +--- android.arch.lifecycle:livedata:1.1.1
    |    |    |    |    |    |    +--- android.arch.core:runtime:1.1.1
    |    |    |    |    |    |    |    +--- com.android.support:support-annotations:26.1.0 -> 28.0.0
    |    |    |    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
    |    |    |    |    |    |    +--- android.arch.lifecycle:livedata-core:1.1.1
    |    |    |    |    |    |    |    +--- android.arch.lifecycle:common:1.1.1 (*)
    |    |    |    |    |    |    |    +--- android.arch.core:common:1.1.1 (*)
    |    |    |    |    |    |    |    \--- android.arch.core:runtime:1.1.1 (*)
    |    |    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
    |    |    |    |    |    \--- android.arch.lifecycle:viewmodel:1.1.1
    |    |    |    |    |         \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
    |    |    |    |    +--- com.android.support:localbroadcastmanager:28.0.0
    |    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
    |    |    |    |    \--- com.android.support:print:28.0.0
    |    |    |    |         \--- com.android.support:support-annotations:28.0.0
    |    |    |    +--- com.android.support:support-fragment:28.0.0
    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    +--- com.android.support:support-core-ui:28.0.0
    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:support-core-utils:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:customview:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    \--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:viewpager:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    |    \--- com.android.support:customview:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:coordinatorlayout:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    |    \--- com.android.support:customview:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:drawerlayout:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    |    \--- com.android.support:customview:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:slidingpanelayout:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    |    \--- com.android.support:customview:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:interpolator:28.0.0
    |    |    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    +--- com.android.support:swiperefreshlayout:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    |    \--- com.android.support:interpolator:28.0.0 (*)
    |    |    |    |    |    +--- com.android.support:asynclayoutinflater:28.0.0
    |    |    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    |    |    \--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    |    |    \--- com.android.support:cursoradapter:28.0.0 (*)
    |    |    |    |    +--- com.android.support:support-core-utils:28.0.0 (*)
    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    +--- com.android.support:loader:28.0.0 (*)
    |    |    |    |    \--- android.arch.lifecycle:viewmodel:1.1.1 (*)
    |    |    |    +--- com.android.support:support-vector-drawable:28.0.0
    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    |    \--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    \--- com.android.support:animated-vector-drawable:28.0.0
    |    |    |         +--- com.android.support:support-vector-drawable:28.0.0 (*)
    |    |    |         \--- com.android.support:support-core-ui:28.0.0 (*)
    |    |    +--- com.facebook.fresco:fresco:1.10.0
    |    |    |    +--- com.facebook.fresco:fbcore:1.10.0
    |    |    |    +--- com.facebook.fresco:drawee:1.10.0
    |    |    |    |    +--- com.facebook.fresco:fbcore:1.10.0
    |    |    |    |    \--- com.facebook.fresco:imagepipeline:1.10.0
    |    |    |    |         +--- com.facebook.fresco:imagepipeline-base:1.10.0
    |    |    |    |         |    +--- com.facebook.soloader:soloader:0.5.0 -> 0.6.0
    |    |    |    |         |    +--- com.parse.bolts:bolts-tasks:1.4.0
    |    |    |    |         |    \--- com.facebook.fresco:fbcore:1.10.0
    |    |    |    |         +--- com.facebook.soloader:soloader:0.5.0 -> 0.6.0
    |    |    |    |         +--- com.parse.bolts:bolts-tasks:1.4.0
    |    |    |    |         \--- com.facebook.fresco:fbcore:1.10.0
    |    |    |    +--- com.facebook.fresco:imagepipeline:1.10.0 (*)
    |    |    |    \--- com.facebook.soloader:soloader:0.5.0 -> 0.6.0
    |    |    +--- com.facebook.fresco:imagepipeline-okhttp3:1.10.0
    |    |    |    +--- com.squareup.okhttp3:okhttp:3.10.0 -> 3.12.1
    |    |    |    |    \--- com.squareup.okio:okio:1.15.0
    |    |    |    +--- com.facebook.fresco:fbcore:1.10.0
    |    |    |    \--- com.facebook.fresco:imagepipeline:1.10.0 (*)
    |    |    +--- com.facebook.soloader:soloader:0.6.0
    |    |    +--- com.google.code.findbugs:jsr305:3.0.2
    |    |    +--- com.squareup.okhttp3:okhttp:3.12.1 (*)
    |    |    +--- com.squareup.okhttp3:okhttp-urlconnection:3.12.1
    |    |    |    \--- com.squareup.okhttp3:okhttp:3.12.1 (*)
    |    |    \--- com.squareup.okio:okio:1.15.0
    |    +--- com.android.support:support-v4:28.0.0
    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    +--- com.android.support:support-media-compat:28.0.0
    |    |    |    +--- com.android.support:support-annotations:28.0.0
    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
    |    |    |    \--- com.android.support:versionedparcelable:28.0.0 (*)
    |    |    +--- com.android.support:support-core-utils:28.0.0 (*)
    |    |    +--- com.android.support:support-core-ui:28.0.0 (*)
    |    |    \--- com.android.support:support-fragment:28.0.0 (*)
    |    +--- com.github.bumptech.glide:glide:4.7.1
    |    |    +--- com.github.bumptech.glide:gifdecoder:4.7.1
    |    |    |    \--- com.android.support:support-annotations:27.1.1 -> 28.0.0
    |    |    +--- com.github.bumptech.glide:disklrucache:4.7.1
    |    |    +--- com.github.bumptech.glide:annotations:4.7.1
    |    |    \--- com.android.support:support-fragment:27.1.1 -> 28.0.0 (*)
    |    +--- com.github.bumptech.glide:annotations:4.7.1
    |    \--- com.github.bumptech.glide:okhttp3-integration:4.7.1
    |         +--- com.github.bumptech.glide:glide:4.7.1 (*)
    |         +--- com.squareup.okhttp3:okhttp:3.9.1 -> 3.12.1 (*)
    |         \--- com.android.support:support-annotations:27.1.1 -> 28.0.0
    +--- project :react-native-gesture-handler
    +--- project :react-native-wechat
    |    \--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    +--- project :react-native-code-push
    |    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    |    \--- com.nimbusds:nimbus-jose-jwt:5.1
    |         +--- com.github.stephenc.jcip:jcip-annotations:1.0-1
    |         \--- net.minidev:json-smart:[1.3.1,2.3] -> 2.3
    |              \--- net.minidev:accessors-smart:1.2
    |                   \--- org.ow2.asm:asm:5.0.4
    +--- project :react-native-device-info
    |    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    |    \--- com.google.android.gms:play-services-gcm:+ -> 17.0.0
    |         +--- androidx.collection:collection:1.0.0
    |         |    \--- androidx.annotation:annotation:1.0.0
    |         +--- androidx.core:core:1.0.0
    |         |    +--- androidx.annotation:annotation:1.0.0
    |         |    +--- androidx.collection:collection:1.0.0 (*)
    |         |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
    |         |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
    |         |    |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    |    +--- androidx.arch.core:core-common:2.0.0
    |         |    |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
    |         |         +--- androidx.annotation:annotation:1.0.0
    |         |         \--- androidx.collection:collection:1.0.0 (*)
    |         +--- androidx.legacy:legacy-support-core-utils:1.0.0
    |         |    +--- androidx.annotation:annotation:1.0.0
    |         |    +--- androidx.core:core:1.0.0 (*)
    |         |    +--- androidx.documentfile:documentfile:1.0.0
    |         |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    +--- androidx.loader:loader:1.0.0
    |         |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
    |         |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
    |         |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
    |         |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
    |         |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 (*)
    |         |    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
    |         |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
    |         |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
    |         |    |         \--- androidx.annotation:annotation:1.0.0
    |         |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
    |         |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    \--- androidx.print:print:1.0.0
    |         |         \--- androidx.annotation:annotation:1.0.0
    |         +--- com.google.android.gms:play-services-base:17.0.0
    |         |    +--- androidx.collection:collection:1.0.0 (*)
    |         |    +--- androidx.core:core:1.0.0 (*)
    |         |    +--- androidx.fragment:fragment:1.0.0
    |         |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0
    |         |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
    |         |    |    |    +--- androidx.customview:customview:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    \--- androidx.core:core:1.0.0 (*)
    |         |    |    |    +--- androidx.viewpager:viewpager:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
    |         |    |    |    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
    |         |    |    |    +--- androidx.drawerlayout:drawerlayout:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
    |         |    |    |    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
    |         |    |    |    +--- androidx.interpolator:interpolator:1.0.0
    |         |    |    |    |    \--- androidx.annotation:annotation:1.0.0
    |         |    |    |    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    |    |    \--- androidx.interpolator:interpolator:1.0.0 (*)
    |         |    |    |    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
    |         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    |    |    \--- androidx.core:core:1.0.0 (*)
    |         |    |    |    \--- androidx.cursoradapter:cursoradapter:1.0.0
    |         |    |    |         \--- androidx.annotation:annotation:1.0.0
    |         |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
    |         |    |    +--- androidx.annotation:annotation:1.0.0
    |         |    |    +--- androidx.loader:loader:1.0.0 (*)
    |         |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
    |         |    +--- com.google.android.gms:play-services-basement:17.0.0
    |         |    |    +--- androidx.collection:collection:1.0.0 (*)
    |         |    |    +--- androidx.core:core:1.0.0 (*)
    |         |    |    \--- androidx.fragment:fragment:1.0.0 (*)
    |         |    \--- com.google.android.gms:play-services-tasks:17.0.0
    |         |         \--- com.google.android.gms:play-services-basement:17.0.0 (*)
    |         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
    |         +--- com.google.android.gms:play-services-iid:[17.0.0] -> 17.0.0
    |         |    +--- androidx.collection:collection:1.0.0 (*)
    |         |    +--- androidx.core:core:1.0.0 (*)
    |         |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
    |         |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
    |         |    +--- com.google.android.gms:play-services-stats:17.0.0
    |         |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
    |         |    |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
    |         |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
    |         \--- com.google.android.gms:play-services-stats:17.0.0 (*)
    +--- project :react-native-view-shot
    |    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    |    \--- com.android.support:support-v4:27.+ -> 28.0.0 (*)
    +--- project :react-native-svg
    |    \--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    +--- project :react-native-wheel-picker-android
    |    +--- com.android.support:appcompat-v7:28.0.0 (*)
    |    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    |    \--- cn.aigestudio.wheelpicker:WheelPicker:1.1.2
    +--- project :react-native-linear-gradient
    +--- project :react-native-image-picker
    |    \--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    +--- project :react-native-i18n
    |    \--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    +--- com.android.support:appcompat-v7:28.0.0 (*)
    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
    \--- :dx-captcha-1.4.8
    

    然后发现就是react-native-device-info 这个函数库引用了 Androidx
    在这里插入图片描述
    出错版本:"react-native-device-info": "^0.24.3"
    修改到正确版本: "react-native-device-info": "^2.1.2"

    然后,执行命令:
    npm install && npm audit fix

    更新到指定版本就好。
    参考资料:
    https://github.com/facebook/react-native/issues/25294
    https://blog.csdn.net/sunny_1020/article/details/88556251

    展开全文
  • 前段时间项目时间紧张,ios端因为pod文件冲突,没有使用ios模拟器开发,今天见打算搞一下这个问题。 解决过程主要是如下两个步骤:首先删除项目ios目录下的Pods文件夹,然后...在ReactNative项目根目录运行命令react...

    前段时间项目时间紧张,ios端因为pod文件冲突,没有使用ios模拟器开发,今天见打算搞一下这个问题。
    解决过程主要是如下两个步骤:首先删除项目ios目录下的Pods文件夹,然后进入项目的ios 文件,执行命令pod install,等待pod文件安装完成,重新运行模拟器即可。
    以为这样就完了?我真是Too Young Too Simple。
    在这里插入图片描述
    在ReactNative项目根目录运行命令react-native run-ios,运行程序启动IOS模拟器,报了如下错误:

    Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.
    

    报错截图如下
    在这里插入图片描述

    通过查阅相关资料在reactnative的官方仓库中发现了这个issues:
    iOS build fails to run in with Xcode 11.0 beta 查看下面的评论最终找到了解决方案:
    进入项目根目录,之后找到如下文件,

    myproject/node_modules/react-native/React/Base/RCTModuleMethod.mm
    

    在大概91行处,修改为如下

    static BOOL RCTParseUnused(const char **input)
    {
      return RCTReadString(input, "__attribute__((unused))") ||
             RCTReadString(input, "__attribute__((__unused__))") ||
             RCTReadString(input, "__unused");
    }
    

    添加内容:RCTReadString(input, “attribute((unused))”) ||

    保存后,重新运行命令react-native run-ios ,可以看到项目在模拟器上正常运行了。

    ok,今天分享到此。
    欢迎大家关注我的公众号:君伟说,分享移动端开发技术实战内容及职场生活。

    展开全文
  • cd node_modules/react-native/scripts ./ios-install-third-party.sh 第二步 (可以解决:third-party: ‘config.h’ file not found问题) cd node_modules/react-native/third-party/glog-0.3.5/ …/…/script...

    在项目的目录下,用终端执行:

    第一步
    cd node_modules/react-native/scripts
    ./ios-install-third-party.sh

    第二步 (可以解决:third-party: ‘config.h’ file not found问题)
    cd node_modules/react-native/third-party/glog-0.3.5/
    …/…/scripts/ios-configure-glog.sh

    展开全文
  • 第一步:使用命令加入react-native-camera,并且关联react-native-camera, yarn add react-native-camera react-native link react-native-camera 运行了命令react-native link react-native-camera后,会...

    前提:已经正常运行的项目

     

     

    第一步:使用命令加入react-native-camera,并且关联react-native-camera,

    yarn add react-native-camera
    react-native link react-native-camera

     

    运行了命令react-native link react-native-camera后,会修改两个文件,

    1.android/app/src/main/java/[...]/MainApplication.java,增加了以下内容

    import org.reactnative.camera.RNCameraPackage;

    修改了以下内容,红字部门是新增内容

        @Override
        protected List<ReactPackage> getPackages() {
          return Arrays.<ReactPackage>asList(
              new MainReactPackage(),
                new RNCameraPackage()
          );
        }

    2.android/settings.gradle,增加了以下内容

    include ':react-native-camera'
    project(':react-native-camera').projectDir = new File(rootProject.projectDir,     '../node_modules/react-native-camera/android')

     

     

     

    第二步:在react-native link react-native-camera的基础上进一步更改项目文件

    1.修改android/app/build.gradle,修改了以下内容,红字部分是新增的内容

    dependencies {
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:+"  // From node_modules
        compile (project(':react-native-camera')) {
            exclude group: "com.google.android.gms"
        }
        compile ("com.google.android.gms:play-services-vision:10.2.0") {
            force = true;
        }
    }

     

    2.修改...\android\app\src\main\AndroidManifest.xml,增加摄像头处理权限

    <uses-permission android:name="android.permission.CAMERA" />

     

     

     

    第三步:尝试编译项目,可惜的是编译出错了

     

    查看错误,解决地址:https://github.com/react-native-community/react-native-camera/issues/1252

    修改错误

    修改成以下内容

    重新编译一次,发现已经成功编译成功了

     

    第四步:增加一个react-native页面,打开摄像头

    代码参考地址:http://www.hangge.com/blog/cache/detail_1618.html

     



    另外也比较支持使用react-native-image-picker库选择图片,这样可以先准备好照片,然后上传至系统

    参考地址:http://www.hangge.com/blog/cache/detail_1617.html 

     

     

     

     

     

     

    转载于:https://www.cnblogs.com/weschen/p/8566708.html

    展开全文
  • 参考链接: 1.https://github.com/facebook/react-native/pull/25146/files#diff-263fc157dfce55895cdc16495b55d190
  • android BuildTools
  • 2019独角兽企业重金招聘Python工程师标准>>> ...
  • 尝试在 Ubuntu 14.04 上面进行 react-native 的开发, 安装官方文档进行配置,记录配置流程安装 node.js在官网下载源码安装即可, 安装后查看版本$ node -v安装 watchman文档安装依赖$ sudo apt-get install autoconf...
  • 今天遇到了一个问题:下载了react-native-baidu-map的开源组件,可是在ios中遇到了问题,编译不通过,我想删除这个组件,然后写其他的功能,以后再添加这个地图功能,可是发现无法删除干净,android和ios原生都编译...
  • 一、前言最近开新项目,准备尝试一下 ReactNative,所以前期做了一些调研工作,ReactNative 的优点非常的明显,可以做到跨平台,除了少部分 UI 效果可能需要对不同的平台进行单独适配,其中的核心逻辑代码,都是可以...
  • 理解 RN 框架的一些东西,以便裁剪和对 RN 有个更深入的认识,所以本篇总结了我这段时间阅读源码的一些感触,主要总结了 React Native 启动流程、JS 调用 Java 流程、Java 调用 JS 流程。
  • react-native 0.57版本之后将全面升级babel 7,babel 6 将无法运行。   搞了一天才搞定,醉了。 话不多说,解决方案是,重新安装如下四个库: @babel/core @babel/plugin-proposal-decorators @babel/plugin-...
  • React Native 命令行工具 Python2 JDK 1.8 Idea 安装配置 和react-native中文社区一致 注意 Node 的版本必须高于 8.3,Python 的版本必须为 2.x(不支持 3.x),而 JDK 的版本必须是 1.8(目前不支持 1.9 及更高...
  •  最近做的一个RN项目,需要用到Video组件,首当其冲,自然就是react-native-video了。react-native-video:一个RN的Video组件  关于react-native-video的用法,其实npm官网上已经说的很清楚了,但对于初学者来说...
  • React-Native的好丑就不多说了,有人说很好,有人说很多坑,自己去体会,不过向京东,微软,阿里等大公司都是在用RN的,至少目前Flutter不够成熟之前在我看来RN是比较不错的, 我就只说这一点相信有理由去学习RN了...
  • 2019独角兽企业重金招聘Python工程师标准>>> ...
  • Using HOC via es7 Decorators SyntaxError: Support for the experimental syntax ‘decorators-legacy’ isn’t ...MobX结合ReactNative使用; MobX使用中重要的关键字:observer observable action when autorun..
  • 报错的图如下所示: 网上查了好多问题,都说是android的gradle版本问题,提供的方法都很烦! 最后找到一个简单可行的办法,在此记录下来,供以后查看。 解决方案: 找到android工程下的android/gradle/wrapper/...
  • 错误1 Element type is invalid…:错误描述: Element type is invalid: expected a String(for built-in components) or a class/function(for composite components) but got:object. check the render method of ...
1 2 3 4 5 ... 20
收藏数 1,059
精华内容 423
关键字:

native编译出错 react