Help with extension gradle setup

I’m trying to integrate crashlytics as an extension but i’ve may issues to compile with gradle. I’ve obtaining that result with following error:

buildscript {
	repositories {
		maven {
			url 'http://repo1.maven.org/maven2/'
		}
		maven {
			url 'https://maven.fabric.io/public'
		}
	}
	
	dependencies {
		classpath 'io.fabric.tools:gradle:1.+'
		classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
	}
}

apply plugin: 'com.android.library'
apply plugin: 'io.fabric'

repositories {
  maven { url 'https://maven.fabric.io/public' }
}

dependencies {
	compile fileTree(dir: 'libs', include: ['*.jar'])
	compile project(':deps:extension-api')
	compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
		transitive = true;
	}
}

android {
	compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
	buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
	
	sourceSets {
		main {
			manifest.srcFile 'AndroidManifest.xml'
			java.srcDirs = ['src']
		}
	}
}

crashlytics {
  enableNdk true
  // If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL,
  // you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will
  // automatically be detected by the Fabric plugin.
  androidNdkOut 'obj'
  androidNdkLibsOut 'libs'
  manifestPath 'AndroidManifest.xml'
}

Error:

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.crashlytics.sdk.android:crashlytics:2.7.1.
     Searched in the following locations:
         http://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.pom
         http://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.aar
         file:/C:/Stencyl/android-sdk/android-sdk-windows/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.pom
         file:/C:/Stencyl/android-sdk/android-sdk-windows/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.aar
         file:/C:/Stencyl/android-sdk/android-sdk-windows/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.pom
         file:/C:/Stencyl/android-sdk/android-sdk-windows/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/2.7.1/crashlytics-2.7.1.aar
     Required by:
         bin:app:unspecified > bin.deps:crashlytics:unspecified

Hope somone can help because i’m really stuck :slight_smile:
David.

Is that the proper file name? Maybe there’s a missing classpath?

All data are get from crashlytics documents, that’s why I hate gradle :smiley:
I’m not a gradle expert, I think there’s something wrong with my integration :frowning:

What if instead of this…

maven {
	url 'http://repo1.maven.org/maven2/'
}
maven {
	url 'https://maven.fabric.io/public'
}

…you tried this?

maven {
	url 'http://repo1.maven.org/maven2/'
	url 'https://maven.fabric.io/public'
}

Thanks for reply, i’ve tried but doesn’t work.
With this version I’ve a correct response from gradle but an issue with crashlytics with following error:

buildscript {
	repositories {
		maven {
			url 'http://repo1.maven.org/maven2/'
		}
		maven {
			url 'https://maven.fabric.io/public'
		}
	}
	
	dependencies {
		classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
		classpath 'io.fabric.tools:gradle:1.+'
	}
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
  compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
  buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
	
  sourceSets {
		main {
			manifest.srcFile 'AndroidManifest.xml'
			java.srcDirs = ['src']
		}
	}
}

dependencies {
	compile fileTree(dir: 'libs', include: ['*.jar'])
	compile project(':deps:extension-api')
	compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
        transitive = true
    }
}

crashlytics {
  enableNdk true
  androidNdkOut 'obj'
  androidNdkLibsOut 'libs'
  manifestPath 'AndroidManifest.xml'
}
java.lang.IllegalArgumentException: Crashlytics could not parse the Android Project structure. 
Contact [email protected] for assistance.
	at com.crashlytics.tools.android.DeveloperTools.processProperties(DeveloperTools.java:488)
	at com.crashlytics.tools.android.DeveloperTools.processArgsInternal(DeveloperTools.java:348)
	at com.crashlytics.tools.android.DeveloperTools.gradleMain(DeveloperTools.java:292)

In your opinion, what about trying to integrate directly in the template? I’ve tryed to adjust AndroidManifest.xml path pointing to app manifest but error do not change.

Thanks in advance.
David.

Oh yeah, looks like you are supposed to have multiple maven blocks after all. Oops.

Anyway, what do you mean by “adjust AndroidManifest.xml path pointing to app manifest”? Are you talking about that last line of code that says manifestPath 'AndroidManifest.xml'? Because that should be fine as-is. If you want to customize a manifest file, you can customize that one rather than adding a new one.

But that said, the error message doesn’t sound like it has anything to do with your manifest at all. The part about “could not parse the Android Project structure” makes it sound like you have a file or folder in the wrong place; what does your file structure look like? Also, the function that crashed, processProperties(), sounds like it’s for parsing either local.properties or gradle.properties. What do those files look like?

Oh, and one more thing…

If so, then you should be using apply plugin: 'com.android.library' instead of apply plugin: 'com.android.application'. Why did you change that?