A problem occured while building application with \'react-native-maps\'
here is my setting.gradle file
include \':react-native-maps\'
project(\':reac
Working fine after downgrading from react-native-maps@0.7.1 to react-native-maps@0.4.2
I am using react-native@0.29.0
Here is my settings:
android/app/build.gradle
dependencies {
compile project(':react-native-maps')
}
android/settings.gradle
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/android')
MainApplication.java
package com.package;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
import com.AirMaps.AirPackage; // <- Add this line
import com.i18n.reactnativei18n.ReactNativeI18n;
import com.oblador.vectoricons.VectorIconsPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new AirPackage(), // <- Add this line
new MainReactPackage(),
new ReactNativeI18n(),
new VectorIconsPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
AndroidManifest.xml
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<!--reference your google_map_id-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_map_id"/>
</application>
I was following instructions from:
https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md
I noted that android/settings.gradle
should point to react-native-maps/lib/android
as below:
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
The error is in the dependecies in build.gradle file try with this:
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'
}
Deleting the line compile project(':react-native-maps')
the problem is resolved. This line is created by rnpm link
but is a bug.
In MainActivity.java should be like this:
package com.yourapp; //<- put your app name
import com.facebook.react.ReactActivity;
import com.airbnb.android.react.maps.MapsPackage; //<- this line is important
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
return "yourapp"; //<- put your app name
}
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage(this) //here you must be write the param this
);
}
}