Giter VIP home page Giter VIP logo

Comments (13)

wumke avatar wumke commented on July 28, 2024 2

Hmmm, so from RN 60 upwards if you do not link packages they still work?
I did not find time to experiment and read what changed in RN 60... but if not linking packages fixes issues than I should mention this in the readme of all my published packages!

(I really hope RN gets mature quickly and does not change package imports anymore, that is a real pain in the ass for package publishers! They should increase major version number for every breaking change if you'd ask me, that would make it easy to spot possible issues and make migration guides!)

from react-native-immediate-phone-call.

HZSamir avatar HZSamir commented on July 28, 2024 1

Having the same issue on RN 0.60.5.
Edit: I have managed to fix this issue by patching node_modules/react-native-immediate-phone-call/android/build.gradle compileSdkVersion to 28 and targetSdkVersion to 27
Other than that Mainapplication.java and Mainactivity.java are left untouched (don't follow the readme for RN 0.60, the autolinking feature takes care of everything)
For the patching just use https://github.com/ds300/patch-package to avoid having to manually patch it after every yarn install.
Hope this helps @arrygoo

from react-native-immediate-phone-call.

arrygoo avatar arrygoo commented on July 28, 2024

I have the same issue :( Tried a bunch of solutions but nothing works

from react-native-immediate-phone-call.

ldco2016 avatar ldco2016 commented on July 28, 2024

@arrygoo ,

This configuration worked for me:

package com.nfibengage;

import android.app.Application;
import android.util.Log;

import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.wix.RNSwipeView.SwipeViewPackage;
// import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
// import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
// import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage;
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
import io.sentry.RNSentryPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.facebook.react.ReactNativeHost;
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 AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)));
      // packages.add(new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)));
      // packages.add(new AppCenterReactNativePackage(MainApplication.this));
      packages.add(new ReactNativeOneSignalPackage());
      packages.add(new RNSentryPackage());
      packages.add(new RNDeviceInfo());
      new SplashScreenReactPackage();
      packages.add(new RNImmediatePhoneCallPackage());
      packages.add(new SwipeViewPackage());
      return packages;
    }

Try the above, if you still have problems, at least you will know that its not your MainApplication.java because the above works. Best of luck.

from react-native-immediate-phone-call.

arrygoo avatar arrygoo commented on July 28, 2024

Sadly that didn't work for me :(

from react-native-immediate-phone-call.

ldco2016 avatar ldco2016 commented on July 28, 2024

@arrygoo , your issue is elsewhere in your code then. The configuration above is solid. Ensure you do a gradle clean as well.

from react-native-immediate-phone-call.

ldco2016 avatar ldco2016 commented on July 28, 2024

@Unforgiven-wanda ,

I am getting this error again when I attempt to generate apk vial assembleRelease, but it does not give me the error when I run bundleRelease.

I tried your patch-package and it did not work either.

Now are you suggesting that we do not need this for RN 60.4?

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

from react-native-immediate-phone-call.

HZSamir avatar HZSamir commented on July 28, 2024

Here is my working MainApplication.java

package com.igniteandross;

import android.app.Application;
import android.util.Log;

import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;

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());
      return packages;
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

You'll notice I do not import RNImmediatePhoneCallPackage and it works fine, even with assembleRelease in my case.

My MainActivity.java

package com.igniteandross;
import com.calendarevents.CalendarEventsPackage;

import android.os.Bundle;
import com.facebook.react.ReactFragmentActivity;

      import com.facebook.react.ReactActivityDelegate;
      import com.facebook.react.ReactRootView;
      import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

public class MainActivity extends ReactFragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(null);
    }

  @Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {
      @Override
      protected ReactRootView createRootView() {
       return new RNGestureHandlerEnabledRootView(MainActivity.this);
      }
    };
  }

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "igniteAndross";
    }

    @Override
  public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
      CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

from react-native-immediate-phone-call.

ldco2016 avatar ldco2016 commented on July 28, 2024

@Unforgiven-wanda ,

I completely removed react-native-immediate-phone-call, unlinked it from android. cleaned my project, removed it from MainApplication.java and reinstalled it and I am still getting that same error.

Should I also remove it from build.gradle and any other files in android?

from react-native-immediate-phone-call.

arrygoo avatar arrygoo commented on July 28, 2024

@ldco2016 @Unforgiven-wanda
Same, I still get the same error.

I tried @Unforgiven-wanda's solution of updating sdk versions, but it causes the app to crash on open

from react-native-immediate-phone-call.

wumke avatar wumke commented on July 28, 2024

I've found https://github.com/react-native-community/cli/blob/master/docs/autolinking.md which tells us to unlink it... but I think you should also remove it from the build.gradle then (like @ldco2016 suggests)

OR (I've read but not tested) you can exclude this package from autolinking and link it the old way, scroll all the way down on the link page.

Let me know what worked, and what did not. Together we will figure it out ;-)

from react-native-immediate-phone-call.

ldco2016 avatar ldco2016 commented on July 28, 2024

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

from react-native-immediate-phone-call.

arrygoo avatar arrygoo commented on July 28, 2024

@ldco2016 That solution fixes the build for me but causes the app to crash on open :(

from react-native-immediate-phone-call.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.