Cannot compile MPChartExample from MPAndroidChart package in Android - android

I have updated gradle that comes with MPChartExample to 1.0.0 and when trying to compille it below message is thrown:
Gradle 'MPChartExample' project refresh failed.
Error:Library projects cannot set applicationId. applicationId is set to 'com.github.mikephil.charting' in default config.
What am I doing wrong?

In your library\app level build.gradle remove the applicationId. Libraries do not require an id. It is for applications.

Related

"The specified Android SDK Build Tools version (26.0.0) is ignored..."

In Android Studio 3, I'm seeing this issue:
The specified Android SDK Build Tools version (26.0.0) is ignored, as
it is below the minimum supported version (26.0.2) for Android Gradle
Plugin 3.0.0.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.0'" from
your build.gradle file, as each version of the Android Gradle Plugin
now has a default version of the build tools.
The problem is that because these are third-party/vendor modules that have buildToolsVersion '26.0.0', I can't modify their build.gradle without forking each submodule.
Is there a way to set a global buildToolsVersion that will override all the sub build.gradles?
Here if you are referring to my previous answers Here is an Update.
1. Compile would be removed from the dependencies after 2018.
a new version build Gradle is available.
Use the above-noted stuff it will help you to resolve the errors. It is needed for the developers who are working after March 2018. Also, maven update might be needed. All above answers will not work on the Android Studio 3.1. Hence Above code block is needed to be changed if you are using 3.1. See also I replaced compile by implementation.
Open app/build.gradle file
Change buildToolsVersion to buildToolsVersion "26.0.2"
change compile 'com.android.support:appcompat to compile 'com.android.support:appcompat-v7:26.0.2'
Solution to this problem is simple
Go to build.gradle (module.app) file
It will help us to rebuild gradle for the project, to make it sync again.
Update to Android Studio 3.0.1 which treats these as warnings.
Android 3.0 was treating such warnings as errors and hence causing the gradle sync operation to fail.
Set the buildToolsVersion '26.0.2' then change classpath 'com.android.tools.build:gradle:3.0.1'.
Make sure you set compileSdkVersion to 26 whiles targetSdkVersion is also set 26.
It is also appropriate to sent set compile 'com.android.support:appcompat-v7:26.0.2'.
just clean and make project / rebuilt fixed my issue give a try :-)
invalidate cache in android studio will resolve this issue. Go to file-> click on invalidate cache/restart option.
Many times as API's are updated. We forgot to update SDK Managers. For accessing recent API's one should always have highest API Level updated if possible should also have other regularly used lower level APIs to accommodate backward compatibility.
Go to build.gradle (module.app) file
change compileSdkVersion
buildToolsVersion
targetSdkVersion, all should have the highest level of API.

Gradle Error:Execution failed for task ':app:processDebugGoogleServices'

I am following this link to integrate Google sign-in in my android app.https://developers.google.com/identity/sign-in/android/start-integrating
As given in last step on the above given page we have to include dependency
compile 'com.google.android.gms:play-services-auth:8.3.0'
in app-level build.gradle file but doing so and building project an error comes saying
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.brainbreaker.socialbuttons"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
}
In the build.gradle file the compile dependency line compile 'com.google.android.gms:play-services-auth:8.3.0' shows error
All com.google.android.gms libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 8.3.0, 8.1.0. Examples include
com.google.android.gms:play-services-base:8.3.0 and
com.google.android.gms:play-services-measurement:8.1.0 There are some
combinations of libraries, or tools and libraries, that are
incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion.)
Here are the messages of gradle build.
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :social_buttons:generateDebugSources, :social_buttons:generateDebugAndroidTestSources, :social_buttons:compileDebugSources, :social_buttons:compileDebugAndroidTestSources]
:clean UP-TO-DATE
:app:clean
:social_buttons:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Information:BUILD FAILED
Information:Total time: 3.49 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
I am not able to see any way out for this version conflict. Any help is appreciated.
I'v got a same issue. but Now I'm fixed.
You should delete a line apply plugin: 'com.google.gms.google-services'
because "com.android.application" package already has same package.
I had the same issue and resolved it by adding the following line in the dependencies of the project-level build.gradle:
classpath 'com.google.gms:google-services:3.0.0'
For a full working example, check out the following project on github.
Hope this helps :)
I was finding the same error complaining about mixing google play services version when switching from 8.3 to 8.4. Bizarrely I saw reference to the app-measurement lib which I wasn't using.
I thought maybe one of my app's dependencies was referencing the older version so I ran ./gradlew app:dependencies to find the offending library (non were).
But at the top of task output I found a error message saying that the google plugin could not be found and defaulting to google play services 8.3. I used the sample project #TheYann linked to compare. My setup was identical except I applied the apply plugin: 'com.google.gms.google-services' at the top my app's build.gradle file. I moved to bottom of the file and that fixed the gradle compile error.
I also faced the same issue. But I forgot to add google-services.json in my project. You can get this file from Google.
Ensure that you have done these two things under defaultConfig in Android/app/build.gradle after wiring up Firebase for your Flutter app.
1) Whatever package name you entered while creating your Firebase android project, exactly the same should be updated as your applicationId under defaultConfig.
2) Add the line multiDexEnabled true under defaultConfig.
So defaultConfig{} should now look something like this
defaultConfig {
applicationId "com.companyName.appName"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
I've solved this problem by deleting the google-services.json file and downloading it again from Firebase console.
Had the same problem
i added compile 'com.google.android.gms:play-services-measurement:8.4.0'
and deleted apply plugin: 'com.google.gms.google-services'
I was using classpath 'com.google.gms:google-services:2.0.0-alpha6' in the build project.
In my case when i was using firebase services the google.json file was mismatched check once that also
Important note: You should only apply plugin at bottom of build.gradle (App level)
apply plugin: 'com.google.gms.google-services'
I mistakenly apply this plugin at top of the build.gradle. So I get error.
One more tips : You no need to remove even you use the 3.1.0 or above. Because google not officially announced
classpath 'com.google.gms:google-services:3.1.0'
I just had to delete and reinstall my google-services.json and then restart Android Studio.
If you trying to connect to firebase, check if your app package name is the same as what is in google-services JSON file.
"client": [
{
"client_info": {
"mobilesdk_app_id": "......",
"android_client_info": {
"package_name": "com.something.package"
}
}, ...
thanks and good luck.
had the same issue as described by #scottyab.
all references were 8.4.0 but it failed due to a reference to app-measurement 8.3.0 that i did not reference anywhere (but one of the dependencies?).
you can see the problem if you hover over the bad(red) dependency in Android Studio.
explicitly adding
compile 'com.google.android.gms:play-services-measurement:8.4.0'
to app.gradle solved the issue.
Also please check your package name in Manifest and package name in google services json file. If both have package name differ from one another u will have this issue.
I fixed it without deleting apply plugin: 'com.google.gms.google-services'
I had the error Execution failed for task ':app:processDebugGoogleServices' because I was using two different versions of google services in my dependencies :
implementation "com.google.android.gms:play-services-maps:11.8.0"
implementation "com.google.android.gms:play-services-nearby:16.0.0"
I changed it to :
implementation "com.google.android.gms:play-services-maps:11.8.0"
implementation "com.google.android.gms:play-services-nearby:11.8.0"
Then it worked
When you create an android application in firebase console you should set your application package in future it will be recorded to google-services.json.
So this error can happen when you try to add google services in the application which has a different package (Current application package will not match to which was recorded to google-services.json).
My package name, when creating an application in Firebase, had an underscore '_' in the name.
I mistakenly excluded the underscore. Changing the package name in firebase solved this issue for me.
I ran into the same issue, I followed the top three steps in this thread.
However, I later found that package_name should match with appID in the google-service.json file as well.
Do look at what your package_name says in google.service.json and match it with the actual app id.
If You are trying to solve this problem for firebase then use this....
Deleting the ** 'com.google.gms.google-services' ** is not the correct way, this problem occurs because of the name changes.
Need to give the same name in the format firebase package name == android package name (check it in /android/app/src/main/AndroidManifest.xml)
Just change the name as android package name then again download the google-services.json then paste it in the /android/app/ like this (/android/app/google-services.json) and run your npm eg. npx react-native run-android
It will work 100%.
I had a similar issue/error..
fixed it by moving
apply plugin: 'com.google.gms.google-services'
to the end of app level gradle file.
And updated the version of gms:play-services and gms:play-services auth
same issue i have.
i tired all possible solutions that i found.
but non were worked.
always got this error
Cannot add task ':processDebugGoogleServices' as a task with that name already exists
Now, i solved it.
1) first i checked my config.xml
2) and removed unnecessary plugin. (I used firebase fcm plugin for pushnotification, but there was two unnecessary plugin phonegap-plugin-push and cordova-plugin-customurlscheme. I removed both these plugins)
3) then removed platform.
4) then add platform
5) then build it.
6) now it build successfully.
Had the same problem with malformed error
Deleted the line apply plugin: 'com.google.gms.google-services'
And the build got successful
NEVER DELETE apply plugin: 'com.google.gms.google-services' from the gradle. Sometimes you are using com.google.gms:google-services:3.1.0 , without apply plugin: 'com.google.gms.google-services' your gradle build successfully. BUT IT IS COMPLETELY WRONG !!!! This error comes due to google-service.json file is not at the correct location. Go to your PROJECT TAB at left side above. If you display it as ANDROID make it PROJECT then check your google-service.json file is at this location. EXPAND app then see google-service.json file below the build.gradle. IF NOT PLACE IT THERE BY RIGHT CLICK ON THE app .
This error comes up when there is change in your config.xml file resulting in mismatching of the data present in google-services.json file.
I got it fixed this just by updating changes to my google-services.json file and building the app again ...it worked well.
If you´re building a new app, put the jsonfile in the right place and make sure it's the jsonfile for that app. Before I realized this, when I clicked the jsonfile, I didn't get the information that wanted.
Go to firebase configurations, download the correct version of google-services.json, and replace the version that didn't work for you. When using the wrong version, you might see the wrong Projectid, storagebucket etc.
check gradle.properties and add
android.useAndroidX=true or you can also add
android.enableJetifier=true or you can comment it by #
worked for me
if you got an error
Execution failed for task ‘:app:fabricGenerateResourcesDebug’.
Crashlytics Developer Tools error.
remove also this line:
apply plugin: 'io.fabric'
In my case i have multiple product flavors. It used to work earlier. It stopped working after updating project gradle version to 4.0.1 and 'google-services:4.3.4'.
I got error like 'Task :app:processDebugGoogleServices FAILED' when i run the project.
I replaced 'google-services.json' in app module with 'my-product-flavor/google-services.json'. It is working fine now.
None of the answers here helped. I needed to have "apply plugin: 'com.google.gms.google-services'" in my gradle. What helped was updating Android Studio to the latest version. I was then able to add the plugin and connect to Firebase Messaging Service.
What work for me is
add this in build.Gradle(Project)
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
Try adding FirebaseAuth even though you don't need it. Don't delete any plugins.
This worked for me. Thanks.

OpenCV Library error with AndroidStudio

I'm having issues with current Android project I'm working on, It has OpenCV Library imported as Module and set as dependency. After updating Android Studio from 0.8.14 to 1.0, and trying to sync Gradle I'm getting following error:
Error:Library projects cannot set applicationId. applicationId is set
to 'org.opencv' in default config.
I'd like to post my project structure and grade file, but I can't upload images yet.
Try commenting applicationID out of your library module's build.gradle file. Like this:
defaultConfig {
// applicationId "com.library.package"
minSdkVersion 14
targetSdkVersion 21
}
I'm still new at Android Studio, and am by no means an expert, but I got the same error after upgrading and this seems to fix it.
I tried to use comment, but instead to fix it, it generate new error (SOLVED).
With "applicationId 'lecho.lib.hellocharts'" enabled:
Library projects cannot set applicationId. applicationId is set to 'lecho.lib.hellocharts' in default config
With "applicationId 'lecho.lib.hellocharts'" disabled (as comment):
A problem occurred configuring project ':hellocharts-library'.
Exception thrown while executing model rule: org.gradle.api.publish.plugins.PublishingPlugin$Rules#addConfiguredPublicationsToProjectPublicationRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectPublicationRegistry, org.gradle.api.publish.PublishingExtension, org.gradle.api.internal.project.ProjectIdentifier)
java.lang.NullPointerException (no error message)
I found solution.

Importing Urban Airship in Android Studio gives compile issues?

I'm new to Android Studio and i want to implement Urban Airship in one of my projects. I followed the example on their website with the .aar file and I ended up getting this error.
Error: [/Users/AndroidstudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.urbanairship/urbanairship-lib/5.1.0/AndroidManifest.xml:8]
Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
Correct me if I'm wrong but doesn't this mean that they have issues in their manifest file? Or am I completely out in the blue? If so, do anyone have a good example on how to implement it?
The Urban Airship SDK builds against Google Play Services that requires Android API 9, while Urban Airship is compatible with 6+. That is why we need the override library version. What android gradle plugin version are you using? You need to use 13.3 or greater. See http://tools.android.com/tech-docs/new-build-system.
In the projects build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
I just had the same problem, and was able to fix it and build my project:
The offending line is line 8 of the AndroidManifest.xml
I just removed this line and changed some SDK versions.
You can open the file urbanairship-lib-5.1.0.aar using WinRar.
Navigate to the Manifest. Open it and edit within your favourite text editor.
Save and close the manifest. WinRar asks if you want to update the archive. Choose Yes!
According to this page, overrideLibrary is used for when you have minSDK version in a library > minSDK version in your project. So it allows a different version to be compiled instead, without errors.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:overrideLibrary-marker
Remove, replace etc do something a bit different (also described on that page - scroll up).
Then in my projects build.gradle file I changed the version numbers to match my project:
From this
compile 'com.android.support:support-v4:21.+'
To this
compile 'com.android.support:support-v4:19.+'
Would be good to know what's the outcome of the OP's support ticket. Please keep us posted!
I ran into this issue as well evaluating the 5.1.0 version of the Urban Airship SDK. I am using Android Studio Beta 0.8.14. I contacted Urban Airship support and they told me to increment the version of gradle to 0.13.3. Android Studio 0.8.14 is defaulting to 0.13.2. After changing the version of gradle to 0.13.3 in the project build.gradle file I was able to successfully compile and import the new SDK.

Unresolved dependencies error in IntelliJ IDEA

So i just started working with IntelliJ and created my first project, but i get this error in the Messages make
and this in the Event log
this is the content of my my build.gradle file
Can someone please help?
Try this in your Gradle build file:
dependencies {
compile 'com.android.support:appcompat-v7:18.0.+'
}
Your one dependency (of the form groupId:artifactId:version) is not quite right. You have the version listed as just +. Instead, it needs to be 18.0.+, which specifies a release version of 18.0.0 or greater.
See here for details.

Categories

Resources