-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] could you update readme for android installation react-native 0.18.0-rc #74
Comments
Will look into it. |
This seems to work fine on react-native 0.18.0-rc. package com.testapp;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.imagepicker.ImagePickerPackage;
import android.content.Intent;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends ReactActivity {
private ImagePickerPackage mImagePicker;
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "testapp";
}
/**
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
mImagePicker = new ImagePickerPackage(this);
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
mImagePicker);
}
// handle onActivityResult
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mImagePicker.handleActivityResult(requestCode, resultCode, data);
}
} |
thanks @alexbndk |
Thank you @alexbndk. Will try this way and find out if there is any issues/ |
Since RN 0.18.0 is now released will make some update and add a "more easy way" to add the package in MainActivty with 2 lines |
@alexbndk I've just upgraded to 0.19.0, and I've tried your exact code and I'm getting the following error when I try to compile, any ideas? package com.MyAppName;
import com.facebook.react.ReactActivity;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.imagepicker.ImagePickerPackage;
import android.content.Intent;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends ReactActivity {
private ImagePickerPackage mImagePicker;
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MyAppName";
}
/**
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
mImagePicker = new ImagePickerPackage(this);
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage(),
mImagePicker);
}
// handle onActivityResult
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mImagePicker.handleActivityResult(requestCode, resultCode, data);
}
} |
You paste your implementation not an issue |
The error message I get back is the following:
|
Since you get the folowing error
I assume that you don't update you RN version in your package.json or you miss something in your update of RN. Since it's not related to this package please open an issue on the React-native repo or look closely on the react-native documentation if you get this kind of issue. |
ok thanks for your help |
@alexbndk's code worked for me when installing the component on 0.20.0. Would have saved me quite some time if this was added to the README. |
README updated for latest android installation instructions |
@alexbndk I changed my code like your,but had a error:"package com.imagepicker does not exist." I searched the package use google,but I couldn't find out it.how to solve the problem? I used react-native to develope android. |
@codepandy Add |
my MainActivity.java file is
The text was updated successfully, but these errors were encountered: