Я перешел с реакции собственной навигации v1 на v2, и у меня есть 5 ошибок при попытке синхронизировать мои файлы с Android Studio.
Невозможно разрешить зависимость для ': app @ debug / compileClasspath': не удалосьразрешить проект: response-native-navigation.
Невозможно разрешить зависимость для ': app @ debugAndroidTest / compileClasspath': не удалось разрешить проект: Reaction-native-navigation.
Невозможно разрешить зависимостьдля ': app @ debugUnitTest / compileClasspath': не удалось разрешить проект: Reaction-native-navigation.
Невозможно разрешить зависимость для ': app @ release / compileClasspath': не удалось разрешить проект: Reaction-native-navigation.
Невозможно разрешить зависимость для ': app @ releaseUnitTest / compileClasspath': не удалось разрешить проект: response-native-navigation.
Я пытался очистить файлы .iml и папку .idea., аннулировать кэши и перезапустить.
Конфигурация: response-native: 0.51.0, response-native-navigation: ^ 2.4.0, Android Studio: 3.1.1
Android build.gradle
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url 'https://jitpack.io' }
jcenter()
}
}
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"
}
subprojects { subproject ->
afterEvaluate {
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("reactNative55") || names.contains("reactNative56") || names.contains("reactNative57")) {
setIgnore(true)
}
}
}
}
}
}
Приложение build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.myapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative51"
multiDexEnabled true
versionCode 723
versionName "1.72"
ndk {
abiFilters "armeabi-v7a", "x86"
}
versionNameSuffix '3'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
productFlavors {
}
}
dependencies {
compile project(':react-native-appsflyer')
compile project(':react-native-text-input-reset')
compile project(':bugsnag-react-native')
compile project(':react-native-version-check')
compile project(':react-native-video')
compile project(':react-native-intercom')
compile project(':react-native-fast-image')
compile project(':react-native-device-info')
compile project(':react-native-rate')
compile(project(':react-native-firebase')) {
transitive = false
}
compile project(':react-native-fbsdk')
compile project(':react-native-linear-gradient')
implementation fileTree(dir: "libs", include: ["*.jar"])
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
// From node_modules
compile 'com.facebook.fresco:animated-gif:1.3.0'
implementation project(':react-native-navigation')
// Firebase dependencies
compile 'com.google.android.gms:play-services-base:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-firestore:11.6.0'
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms'
}
compile('com.google.android.gms:play-services-base:11.6.0') {
force = true;
}
compile('com.google.android.gms:play-services-maps:11.6.0') {
force = true;
}
compile('com.google.android.gms:play-services-gcm:11.6.0') {
force = true;
}
implementation "com.google.firebase:firebase-analytics:11.6.0"
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation project(':react-native-fbsdk')
implementation "com.google.firebase:firebase-messaging:11.6.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
MainActivity.java
package com.myapp;
import com.reactnativenavigation.NavigationActivity;
import android.content.Intent;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerConversionListener;
public class MainActivity extends NavigationActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
// @Override
// protected String getMainComponentName() {
// return "MyApp";
// }
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}
}
MainApplication.java
package com.myapp;
import com.BV.LinearGradient.LinearGradientPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
// import com.facebook.react.shell.MainReactPackage;
// import com.facebook.soloader.SoLoader;
import com.reactnativenavigation.NavigationApplication;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.reactnativenavigation.react.ReactGateway;
import com.nikolaiwarner.RNTextInputReset.RNTextInputResetPackage;
import com.reactlibrary.RNRatePackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.appevents.AppEventsLogger;
import com.airbnb.android.react.maps.MapsPackage;
import io.xogus.reactnative.versioncheck.RNVersionCheckPackage;
import com.bugsnag.BugsnagReactNative;
import com.brentvatne.react.ReactVideoPackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.robinpowered.react.Intercom.IntercomPackage;
import io.intercom.android.sdk.Intercom;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.app.Activity;
// import com.reactnativenavigation.controllers.ActivityCallbacks;
// import com.facebook.react.ReactApplication;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import com.appsflyer.reactnative.RNAppsFlyerPackage;
public class MainApplication extends NavigationApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected ReactGateway createReactGateway() {
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
@Override
protected String getJSMainModuleName() {
return "index";
}
};
return new ReactGateway(this, isDebug(), host);
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// new MainReactPackage(),
new RNAppsFlyerPackage(MainApplication.this),
new RNTextInputResetPackage(),
BugsnagReactNative.getPackage(),
new RNVersionCheckPackage(),
new ReactVideoPackage(),
new IntercomPackage(),
new FastImageViewPackage(),
new RNDeviceInfo(),
new RNRatePackage(),
new RNFirebasePackage(),
new RNFirebaseMessagingPackage(),
new FBSDKPackage(mCallbackManager),
new LinearGradientPackage(),
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
AppEventsLogger.activateApp(this);
Intercom.initialize(this, "android_sdk-mykey", "mykey");
BugsnagReactNative.start(this);
setActivityCallbacks(new ActivityCallbacks() {
@Override
public void onActivityResumed(Activity activity) {
// Do stuff
}
@Override
public void onActivityPaused(Activity activity) {
// Do stuff
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}
});
FacebookSdk.sdkInitialize(getApplicationContext());
SoLoader.init(this, /* native exopackage */ false);
}
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
@Nullable
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new RNTextInputResetPackage(),
// new MainReactPackage(),
BugsnagReactNative.getPackage(),
new RNVersionCheckPackage(),
new RNRatePackage(),
new RNFirebasePackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseFirestorePackage(),
new RNFirebaseAnalyticsPackage(),
new RNFirebaseMessagingPackage(),
// new RNFirebaseNotificationsPackage(),
new RNDeviceInfo(),
new ReactVideoPackage(),
new IntercomPackage(),
new FastImageViewPackage(),
new MapsPackage(),
new FBSDKPackage(mCallbackManager),
new LinearGradientPackage(),
new RNAppsFlyerPackage(MainApplication.this)
);
}}
Мои настройки. Gradle
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android')
И gradle-wraper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Извините за длинный код, но я, возможно, где-то допустил ошибку.