react-native .58.1无法构建android版本

时间:2019-07-27 17:43:06

标签: java android xml android-studio react-native

我想构建android版本,但是无论尝试如何,我都会遇到相同的错误

这是错误输出

/app/build/generated/assets/react/release/index.android.bundle
bundle: Done writing bundle output
bundle: Copying 9 asset files
bundle: Done copying assets

> Task :app:bundleReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  Output:  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:19: error: resource mipmap/ic_launcher (aka com.characters:mipmap/ic_launcher) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:19: error: resource string/app_name (aka com.characters:string/app_name) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:19: error: resource mipmap/ic_launcher (aka com.characters:mipmap/ic_launcher) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:19: error: resource style/AppTheme (aka com.characters:style/AppTheme) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:27: error: resource string/app_name (aka com.characters:string/app_name) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:54: error: resource xml/provider_paths (aka com.characters:xml/provider_paths) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:59: error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.characters:style/Theme.AppCompat.Light.NoActionBar) not found.
  /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml:67: error: resource integer/google_play_services_version (aka com.characters:integer/google_play_services_version) not found.
  error: failed processing manifest.

  Command: /Users/abdul-elah/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/5141019c42220d362e7004555d4c86c4/aapt2-3.2.1-4818971-osx/aapt2 link --proto-format\
          -I\
          /usr/local/share/android-sdk/platforms/android-28/android.jar\
          --manifest\
          /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml\
          -o\
          /Users/abdul-elah/Projects/characters/characters/android/app/build/intermediates/linked_res_for_bundle/release/bundleReleaseResources/bundled-res.ap_\
          --auto-add-overlay\
          -0\
          apk\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 35s
46 actionable tasks: 3 executed, 43 up-to-date

这是我的manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.characters">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

我尝试编辑compilesdkversion和react-native-device-info,我实际上尝试了每种解决方案,该应用程序在调试模式下运行正常,但在我尝试运行./gradlew bundleRelease时却无法运行

1 个答案:

答案 0 :(得分:0)

我不熟悉Android问题,但就我而言,./gradlew bundleRelease代替了df1 = df.iloc[-3:].copy() # use copy to be allowed to modify the values df1.loc[df1.c < mean, 'c'] = mean # process the copy df.loc[df1.index, 'c'] = df1['c'] # copy back into the original dataframe