反应原生地图doenst存在airmap或MapsPackage类型错误

时间:2018-04-20 10:26:50

标签: react-native-android react-native-maps

我在react-native-maps中遇到问题....请帮助我

当我在mainapplication.java中添加“MapsPackage()”时;     React Native:错误:类MapsPackage中的构造函数MapsPackage不能     适用于给定类型

当我在mainapplication.java中删除“MapsPackage()”时;  没有工作地图,我得到错误“airmap doenst not exist”

我的构建gradle;

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"  // From node_modules
compile 'com.airbnb.android:react-native-maps:0.6.0'
//compile project(':react-native-maps-lib')
}

my mainapplication.java;

package com.polipoolapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
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() {
  return Arrays.<ReactPackage>asList(
      new MapsPackage(),
      new MainReactPackage()
  );
}

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

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

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

我的mainactivity.java;

package com.polipoolapp;   //<- put your app name
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends ReactActivity {

  protected String getMainComponentName() {
return "PolipoolApp"; //<- put your app name
  }

  protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
  }


  }

0 个答案:

没有答案