如何使用assembleRelease上的react-native-immediate-phone-call解决错误

时间:2019-08-29 03:30:44

标签: react-native apk

我正在尝试成功运行./gradlew assembleRelease,但是出现以下错误:

> Task :react-native-immediate-phone-call:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-immediate-phone-call:verifyReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
  error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.

我已经遵循了文档,但是我想知道它是否不正确。

例如,我的MainApplication.java文件是否存在此问题:

import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.github.wumke.RNImmediatePhoneCall.RNImmediatePhoneCallPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;

import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      packages.add(new ReactNativeOneSignalPackage());
      packages.add(new RNSentryPackage());
      packages.add(new RNDeviceInfo());
      packages.add(new SplashScreenReactPackage());
      packages.add(new RNImmediatePhoneCallPackage());
      packages.add(new SwipeViewPackage());
      return packages;
    }

我是否拥有RN 0.60.4所需的资源?

1 个答案:

答案 0 :(得分:2)

要摆脱com.android.builder.internal.aapt.v2.Aapt2Exception,您必须修改以下文件:

node_modules / react-native-immediate-phone-call / android / build.gradle

compileSdkVersion更改为28

targetSdkVersion更改为27