Search code examples
react-nativeapk

How to resolve error with react-native-immediate-phone-call on assembleRelease


I am trying to run a successful ./gradlew assembleRelease, but I am getting the following error:

> 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.

I have followed the documentation, but I am wondering if it is inaccurate.

For example, is this issue with my MainApplication.java file:

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;
    }

Do I have more than whats needed for RN 0.60.4?


Solution

  • To get rid of com.android.builder.internal.aapt.v2.Aapt2Exception you have to modify the following file:

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

    change compileSdkVersion to 28

    change targetSdkVersion to 27