So I'm using this package to try and integrate MapBox into a React-Native project I'm working on, and I keep getting this error when I run it. I've followed the instructions on their page and I'm still getting this, so I assume I forgot to install a package or something along the way. Anyone know how to fix this?
a:17: error: cannot find symbol
protected List getPackages() {
^
symbol: class List
location: class MainActivity
/Github/ReactApp/android/app/src/main/java/com/reactapp/MainActivity.java:17: error: cannot find symbol
protected List getPackages() {
^
symbol: class ReactPackage
location: class MainActivity
/Github/ReactApp/android/app/src/main/java/com/reactapp/MainActivity.java:16: error: method does not override or implement a method from a supertype
@Override
^
/Github/ReactApp/android/app/src/main/java/com/reactapp/MainActivity.java:19: error: cannot find symbol
new MainReactPackage(),
^
symbol: class MainReactPackage
location: class MainActivity
/Github/ReactApp/android/app/src/main/java/com/reactapp/MainActivity.java:18: error: cannot find symbol
return Arrays.asList(
^
symbol: class ReactPackage
location: class MainActivity
/Github/ReactApp/android/app/src/main/java/com/reactapp/MainActivity.java:18: error: cannot find symbol
return Arrays.asList(
^
symbol: variable Arrays
location: class MainActivity
6 errors
EDIT: Here's the source code for MainActivity:
package com.reactapp;
import com.facebook.react.ReactActivity;
import com.oblador.vectoricons.VectorIconsPackage;
import com.mapbox.reactnativemapboxgl.ReactNativeMapboxGLPackage;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "ReactApp";
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeMapboxGLPackage()); // <-- Register package here
}
}
You are missing some imports:
import java.util.List;
import java.util.Arrays;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.react.ReactPackage;
Also one of your @Overrides
is on a method (getPackages) that doesn't override anything from the super class. Remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With