0

I've tried to make a react native app using 3 packages of "appcenter-analytics" and "appcenter-crashes" and "appcenter" for test.

I've done just like what was mentioned in Microsoft documentation (installing an linking the packages with the specified secret key) and when I want to run project with the code "react-native run-android", I face this error

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:processDebugManifest'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
 > Could not resolve project :appcenter-analytics.
 Required by:
 project :app
 > Unable to find a matching configuration of project :appcenter-analytics: None of the consumable configurations have attributes.

android\settings.gradle

rootProject.name = 'anatest'
include ':appcenter-crashes'
project(':appcenter-crashes').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-crashes/android')
include ':appcenter-analytics'
project(':appcenter-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-analytic/android')
include ':appcenter'
project(':appcenter').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter/android')
include ':app'

android\app\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.anatest"
 minSdkVersion rootProject.ext.minSdkVersion
 targetSdkVersion rootProject.ext.targetSdkVersion
 versionCode 1
 versionName "1.0"
 }
 splits {
 abi {
 reset()
 enable enableSeparateBuildPerCPUArchitecture
 universalApk false // If true, also generate a universal APK
 include "armeabi-v7a", "x86", "arm64-v8a"
 }
 }
 buildTypes {
 release {
 minifyEnabled enableProguardInReleaseBuilds
 matchingFallbacks = ['release', 'debug']
 proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
 }
 }
 applicationVariants.all { variant ->
 variant.outputs.each { output ->
 def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
 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
 }
 }
 }
}
dependencies {
 implementation project(':appcenter-analytics')
 implementation project(':appcenter-crashes')
 implementation project(':appcenter')
 implementation fileTree(dir: "libs", include: ["*.jar"])
 implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
 implementation "com.facebook.react:react-native:+" // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
 from configurations.compile
 into 'libs'
}

android\app\src\main\java\com\anatest\MainApplication.java

package com.anatest;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
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 MainReactPackage(),
 new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
 new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
 new AppCenterReactNativePackage(MainApplication.this)
 );
 }
 @Override
 protected String getJSMainModuleName() {
 return "index";
 }
 };
 @Override
 public ReactNativeHost getReactNativeHost() {
 return mReactNativeHost;
 }
 @Override
 public void onCreate() {
 super.onCreate();
 SoLoader.init(this, /* native exopackage */ false);
 }
}

I also tried matching fallbacks in app\build.gradle with the code matchingFallbacks = ['release', 'debug'] also changing react native, wrapper and gradle versions, but nothing worked out :(

I would really appreciate if someone can help me to find a solution.

asked Feb 19, 2019 at 8:04

1 Answer 1

1

appcenter-analytics path is wrong.

In your android\settings.gradle

Change

include ':appcenter'
project(':appcenter').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter/android')

with

include ':appcenter-analytics'
project(':appcenter-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/appcenter-analytics/android')
answered Feb 19, 2019 at 10:25
Sign up to request clarification or add additional context in comments.

1 Comment

its by default like this so and its throwing same error

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.