Appcenter-sdk-react-native: Documentation for android manual link process

Created on 14 Feb 2018  路  9Comments  路  Source: microsoft/appcenter-sdk-react-native

I got problems linking the lib when using react-native-navigation by wix, because it changes the MainApplication.java structure, I solved after reading the AppCenterReactNativePackage, AppCenterReactNativeAnalyticsPackage, AppCenterReactNativeCrashesPackage classes (to understand the constructor arguments) and adding the instances manually to the getPackages method list.

A documentation for the android manual linking process would help people with the same problem.

feature request

Most helpful comment

@campierce88 make sure that these imports are into MainApplication.java file:

import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage;

Then add these packages to getPackages method like this:

protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new AppCenterReactNativePackage(MainApplication.this),
        new AppCenterReactNativeAnalyticsPackage(MainApplication.this, true),
        new AppCenterReactNativeCrashesPackage(MainApplication.this, "ALWAYS"),
        ...other imports
    );
}

There are other steps before this, but the automatic link already did it for me.

All 9 comments

@celso-henrique Can you post how you solved this issue? I'm having the same problem. Thanks!

@campierce88 make sure that these imports are into MainApplication.java file:

import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage;

Then add these packages to getPackages method like this:

protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new AppCenterReactNativePackage(MainApplication.this),
        new AppCenterReactNativeAnalyticsPackage(MainApplication.this, true),
        new AppCenterReactNativeCrashesPackage(MainApplication.this, "ALWAYS"),
        ...other imports
    );
}

There are other steps before this, but the automatic link already did it for me.

@campierce88 let us know if you still need help with this!

@TroubleMakerBen @celso-henrique thank you for the information. We decided to forgo upgrading to AppCenter for now but will keep this tip in mind for when we upgrade in the near future. I appreciate the help!

@celso-henrique hero! Linking it did not add this for me! This is something crucial!

Hey, @MakhouT, can you elaborate on what is not working well for you so that I could assist with your problem?

@Jamminroot Fixed already with @celso-henrique comment.
Basically I did a link, but the link wasn't really successful even though the output of the link is saying that everything is okay.

This 2 lines were not added for me by linking, and I had to add them manually.

 new AppCenterReactNativeAnalyticsPackage(MainApplication.this, true),
  new AppCenterReactNativeCrashesPackage(MainApplication.this, "ALWAYS"),

Oh, glad to hear that it is fixed!
Feel free to contact us if you need assistance.

The doc is available at https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/react-native#34-android-only-integrate-the-sdk-manually-for-react-native-lower-than-060-without-react-native-link.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Maximell picture Maximell  路  9Comments

matthargett picture matthargett  路  7Comments

aprilmintacpineda picture aprilmintacpineda  路  5Comments

elnygren picture elnygren  路  5Comments

thomasgazzoni picture thomasgazzoni  路  5Comments