Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Fails to sync after upgrading to Cordova Android 8.0 #675

Closed
3 tasks done
angjelkom opened this issue Feb 17, 2019 · 12 comments · Fixed by #699
Closed
3 tasks done

Gradle Fails to sync after upgrading to Cordova Android 8.0 #675

angjelkom opened this issue Feb 17, 2019 · 12 comments · Fixed by #699

Comments

@angjelkom
Copy link

angjelkom commented Feb 17, 2019

Bug Report

Problem

What is expected to happen?

The Gradle should sync with success

What does actually happen?

Gradle Sync Fails

Information

After upgrading to Cordova Android 8.0 Gradle sync fails with the following message:

API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Open Manifest File
Move minSdkVersion to build file and sync project

The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.

The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Open Manifest File
Move minSdkVersion to build file and sync project

Command or Code

Open the platforms/android project in Android Studio

Version information

Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
Cordova: 8.1.2
Cordova Android: 8.0
Cordova Plugins:
cordova-plugin-awesome-shared-preferences 0.1.0 "Shared preferences"
cordova-plugin-backbutton 0.3.0 "Backbutton"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-calendar 5.1.4 "Calendar"
cordova-plugin-deeplinks 1.1.0 "Cordova Deeplinks Plugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-firebase-crashlytics 0.0.8 "Cordova Firebase Crashlytics Plugin"
cordova-plugin-google-analytics 1.8.6 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-local-notification 0.9.0-beta.3 "LocalNotification"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.4 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@geoffliddiard
Copy link

Also seeing this issue. Rolling back to cordova-android@7.1.4 until a fix is released

@janpio
Copy link
Member

janpio commented Feb 18, 2019

Thanks for the report.

Can you provide a bit more information? Is this for existing projects that are upgraded? How exactly do you upgrade? How do you usually build this project, only with Android Studio? Is it reproducible with a new Cordova project?

@noledgy
Copy link

noledgy commented Feb 18, 2019

I am able to reproduce this in my upgraded project. I was having the same problem with the previous release (I think 7.1.4).
I created a simple new project, then imported it into Android Studio. Same warnings/errors. It does not appear to be related to upgrades. Very easy to reproduce.

@Crylion
Copy link

Crylion commented Feb 19, 2019

Also experiencing this. The cordova build on the command line works fine, just opening it in Android Studio produces the errors. Android Studio provides a one-click refactor that moves the minSdk entry from the manifest, but that's still a manual step I have to take.

@janpio
Copy link
Member

janpio commented Feb 19, 2019

So can one recreate it by creating a new Cordova project with cordova-android 8.0 and then just opening the project in Android Studio 3.2.1 (or also other versions)?

@rossholdway
Copy link

@janpio I can recreate this by removing all platforms and plugins, then cordova prepare. Opening the the project in Android 3.3.1 displays the Gradle sync issues above.

@janpio
Copy link
Member

janpio commented Feb 19, 2019

Can you try to confirm a reproduction that starts with cordova create? That would be easiest for someone to look into.

@brodybits brodybits added info-needed / awaiting response Further information is requested support labels Feb 19, 2019
@noledgy
Copy link

noledgy commented Feb 19, 2019

create MyTest
cordova platform add android@8.0.0
cordova build
  • Start Android Student (3.3.1)

Just importing, wsync failed:

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Move minSdkVersion to build files and sync project
Affected Modules: CordovaLib, app
  • Remove minSdk from CordovaLib and app manifest
  • Rebuild project get error
  • Close and re-open Android Studio
  • Popup comes up telling you upgrade to Android Gradle plugin to version 3.3.1 and Gradle to version 4.10.1. Do it.

Build now runs

@angjelkom
Copy link
Author

Thanks for the report.

Can you provide a bit more information? Is this for existing projects that are upgraded? How exactly do you upgrade? How do you usually build this project, only with Android Studio? Is it reproducible with a new Cordova project?

I tried:

  1. Using new project cordova create
  2. Removing the platform (7.1.4) and installing the latest (8.0.0)

both ways I get gradle sync issue, with cordova build/run I don't have that problem

@sagrawal31
Copy link
Contributor

sagrawal31 commented Feb 25, 2019

Any workaround while the #680 is merged?

@angjelkom
Copy link
Author

Any workaround while the #680 is merged?

I've just clicked the link in the error message to "move" the minSdk, and I was able to build from android studio after that

@erisu erisu closed this as completed in #699 Apr 6, 2019
TheBosZ pushed a commit to nRFCloud/gateway-cordova that referenced this issue Apr 25, 2019
Remove old crappy way of doing adaptive icons in favor of new hotness

Note: If you try to build in Android Studio, you'll have to click the link in the error message to "move" the minSdk.

Details are here: apache/cordova-android#675
@arashmad
Copy link

@EchoNox It works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants