Gradle build error with branch io and crashlytics - android-studio

Error:A problem occurred configuring root project 'app_name'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.crashlytics.sdk.android:answers-shim:0.0.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim.aar
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
Required by:
:app_name:unspecified > io.branch.sdk.android:library:1.14.2
branch-io originally was io.branch.sdk.android:library:1+ I then tried
io.branch.sdk.android:library:1.14.1 and io.branch.sdk.android:library:1.14.2 with the same error.
Any ideas what is happening?

com.crashlytics.sdk.android:answers-shim:0.0.3 isn't available on mavenCentral. Add jcenter to your repository section.
ref: https://bintray.com/fabric/fabric/com.crashlytics.sdk.android%3Aanswers-shim/view
Example:
repositories {
jcenter()
}

If you don't plan to use the Fabric Answers integration, and don't want to import the answers-shim, just import your project as follows:
replace io.branch.sdk.android:library:1.14.1 with
implementation ('io.branch.sdk.android:library:3.+') {
exclude module: 'answers-shim'
}
Source - https://github.com/BranchMetrics/android-branch-deep-linking

Related

Could not find org.nodejs:node

I am trying to build my gui application (angular implementation) and I am getting the following error:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find
org.nodejs:node:10.14.1.
Searched in the following locations:
- https://nodejs.org/dist/v10.14.1/ivy.xml
build.gradle contains (relevant to nodejs):
node {
version = '10.14.1'
npmVersion = '6.4.1'
download = false
}
dependencies {
classpath("com.moowork.gradle:gradle-node-plugin:1.2.0")
}
}
apply plugin: 'java'
apply plugin: 'com.moowork.node'
gradle.properties contains:
systemProp.https.proxyUser=''
systemProp.https.proxyPassword=''
systemProp.http.proxyUser=''
systemProp.http.proxyPassword=''
systemProp.https.proxyHost=internet.proxy.company.com
systemProp.https.proxyPort=port
systemProp.http.proxyHost=internet.proxy.company.com
systemProp.http.proxyPort=port
npm config contains:
https-proxy=http://internet.proxy.company.com:port/
proxy=http://internet.proxy.company.com:port/
registry=http://registry.npmjs.org/
sslVerify=false
strict-ssl=false
Even if I remove the node js dependency (for giggles), it still throws this error. Any help is greatly appreciated. At first, I thought it was a proxy issue but I do not think that is the case. Any ideas?
com.moowork.node is not actively maintained and has this issue. Switch to the fork of this plugin which is actively maintained and has fixed this issue.
https://github.com/node-gradle/gradle-node-plugin/
For more details as to why it is failing, see this comment.

Add an AAR dependency in Android Studio 4.2

I'm trying to use https://github.com/brim-borium/spotify_sdk in Android Studio with Flutter
As such, I need to import Spotify SDK (two AAR files), and to be able to add them to the build process.
Because of spotify_sdk (flutter package), I can't use (which seem to work)
implementation (name: 'spotify-app-remote', ext: 'aar')
implementation (name: 'spotify-auth', ext: 'aar')
in my project, I specifically need Gradle to consider spotify-app-remote & spotify-auth as projects, because spotify_sdk imports them like this.
implementation project(':spotify-auth')
implementation project(':spotify-app-remote')
Here is the Gradle error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :spotify-auth.
Required by:
project :app
> No matching configuration of project :spotify-auth was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
> Could not resolve project :spotify-app-remote.
Required by:
project :app
> No matching configuration of project :spotify-app-remote was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
Here is my settings.gradle
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
So I need to be able to force Gradle to import these AAR as a projet.
Here is my project structure, if it useful
Project Structure
From documentation and StackOverflow posts, I've read that Android Studio used to have an Import AAR/Jar file functionality. It is now missing in Android Studio 4.2
Is there any functionality that replaces Import AAR/Jar file? Or any way to force Gradle to recognize these files as projects?
Thank you very much

Flutter packages using same class (how to solve class conflict?)

I use this two packages:
barcode_scan: ^0.0.3
fluttie: ^0.3.0
When I try to run my application, I get the following error:
D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/111.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/126.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/57.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/160.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/56.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/64.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/91.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/81.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/156.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/59.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/157.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/141.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/65.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/101.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/94.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/159.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/116.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/60.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/95.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/158.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/151.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/1.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/136.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/146.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/76.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/92.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/131.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/86.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/71.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/62.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/0.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/93.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/106.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/121.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/45.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/rhuka/repository/github/learn/flutter/flutter_lottie_signup/build/app/intermediates/transforms/dexBuilder/debug/41.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
Seems to me that both of them use the same class android.support.v4.app.INotificationSideChannel because when I try to use only one of them everything works fine. But I need both on my application. How can I ignore the duplicated classes or just solve this?
I'm facing the same sort of conflict with qr_code_scanner the solution is to delete or change classes for one of them I don't know if flutter has built-in method to handle this sort of conflicts.
but what you can try is to get package from git repo do the changes push the code to your own repo and pub get from your own git repo:
dependencies:
fluttie:
git:
url: https://github.com/...
ref: main

Trouble Publishing Android Studio Library on jCenter with Bintray

I'm following this tutorial to publish an example Android Studio library on Jcenter:
http://crushingcode.co/publish-your-android-library-via-jcenter/
It seems very clear.
I've created my GitHub repository with this library at this link:
https://github.com/alessandroargentieri/mylibview
I've also Signed in to Bintray.com, and created a new repository which must contain my library (as explained in the tutorial above).
To publish a repository on Bintray I must create an organisation, then you create the repository. So these are my data:
Bintray username: alessandroargentieri
organisation: alexmawashi
repository: https://bintray.com/alexmawashi/my_android_repository
then, in Android Studio, in the gradle file of my library module, I've this data:
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'my_android_repository' //maven
bintrayName = 'mylibview' // Has to be same as your library module name
publishedGroupId = 'mawashi.alex.mylittlelibrary'
libraryName = 'MyLibView'
artifact = 'mylibview' // Has to be same as your library module name
libraryDescription = 'Android Library to use a custom view'
// Your github repo link
siteUrl = 'https://github.com/alessandroargentieri/mylibview'
gitUrl = 'https://github.com/alessandroargentieri/mylibview.git'
githubRepository= 'alessandroargentieri/mylibview'
libraryVersion = '1.0'
developerId = 'alexmawashi'
developerName = 'Alessandro Argentieri'
developerEmail = 'alexmawashi87#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
...
...
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle'
When I use the terminal and write:
gradlew clean build install bintrayUpload --stacktrace
After a few minutes, I get this error:
What went wrong:
Execution failed for task ':mylittlelibrary:bintrayUpload'.
> Could not create package 'alessandroargentieri/my_android_repository/mylibview': HTTP/1.1 404 Not Found [message:Repo 'my_android_repository' was not found]
What am I doing wrong?
Thanks.
There also might be a problem here:
https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle
If your repo belong to your organisation then you are going to need the userOrg parameter set.
See https://github.com/bintray/gradle-bintray-plugin#step-4-add-your-bintray-package-information-to-the-bintray-closure step 4
Also see: HTTP/1.1 401 Unauthorized when uploading binary on bintray
For this to work properly, your gradle.properties file needs to have a bintray.user and a bintray.apikey (which is your bintray API key) configured (see the include in https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle )

Specify ivy configuration in gradle dependency

I want to resolve dependencies from ivy repository but I don't know how to specify ivy configuration for it. I found that I should do it in this way:
myconf group: 'com.eu', module:'MyModule', version:'1.0.0', configuration: 'ivyconf'
but it doesn't work. When I run gradle dependencies command gradle returns this error:
Could not create a dependency using notation: {group=com.eu, module=MyModule, version=1.0.0, configuration=ivyconf}
My build doesn't use plugins. I want to download dependencies in simple build which should create product from downloaded dependencies.
Build looks like this:
group = 'com.eu'
version = '0.9a'
configurations {
myconf
}
repositories {
ivy {
url 'http://ivyrepo.local/ivyrep/shared'
layout "pattern", {
artifact "[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
}
}
}
dependencies {
myconf group: 'com.eu', module:'MyModule', version:'1.0.0', configuration: 'ivyconf'
}
Instead of module, it has to be name. (see "49.4. How to declare your dependencies" in the Gradle User Guide). The declared configuration (myConf) must match the configuration used in the dependencies block (installer).

Resources