编译用于android的反应原生地理编码器时出错

时间:2016-09-16 11:30:38

标签: android react-native

只是想试用Android的RN GeoCoder

但是我在构建期间遇到以下错误:

/GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:16: error: cannot find symbol
    protected List<ReactPackage> getPackages() {
              ^
  symbol:   class List
  location: class MainActivity
GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:16: error: cannot find symbol
    protected List<ReactPackage> getPackages() {
                   ^
  symbol:   class ReactPackage
  location: class MainActivity
/GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:15: error: method does not override or implement a method from a supertype
    @Override
    ^
GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:18: error: cannot find symbol
          new MainReactPackage(),
              ^
  symbol:   class MainReactPackage
  location: class MainActivity
/GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:17: error: cannot find symbol
        return Arrays.<ReactPackage>asList(
                       ^
  symbol:   class ReactPackage
  location: class MainActivity
/GeoCoderTest/android/app/src/main/java/com/geocodertest/MainActivity.java:17: error: cannot find symbol
        return Arrays.<ReactPackage>asList(
               ^
  symbol:   variable Arrays
  location: class MainActivity
6 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.

我尝试导入java.util.Arrays&amp; java.util.List,但我不确定ReactPackage和MainReactPackage类以及@Override注释。

期待可行的解决方案。

1 个答案:

答案 0 :(得分:0)

尝试更新MainApplication.java而不是MainActivity.java