New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 841529 link

Starred by 0 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 620034



Sign in to add a comment

Android Studio: Fix error about uses-sdk

Project Member Reported by wnwen@chromium.org, May 9 2018

Issue description

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.

Channel: canary

Relevant: https://stackoverflow.com/questions/34234841/minsdk-and-targetsdk-in-androidmanifest-and-build-gradle-both

 
Project Member

Comment 1 by bugdroid1@chromium.org, May 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f3c401c7f25b5dfeb934212ab0934c638855a7ac

commit f3c401c7f25b5dfeb934212ab0934c638855a7ac
Author: Peter Wen <wnwen@chromium.org>
Date: Thu May 10 16:16:05 2018

Android: Basic support for C++ in Android Studio

Add a new flag for generate_gradle.py, --native-target <gn target name>.
This allows C++ editing when --all is either passed or implicit (by
default). Starting with --native-target //chrome/android:monochrome in
Android Studio Canary (3.2) will result in most of the C++ files being
indexed and available both via the Android project view as well as the
double shift "search everywhere" box.

Switched maven URL to use "google()" instead, this works for all Android
Studio 3.0+, which covers all of stable/beta/canary.

Add specific AndroidManifest.xml to be used for the _all pseudo gradle
module since Android Studio now requires minSdk to not be specified in
the AndroidManifest.xml file.

Bug: 841529,827294, 840368 
Change-Id: Ifdee12bf7f9e7faf81cabf92dbf4c5613eb89996
Reviewed-on: https://chromium-review.googlesource.com/1053117
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557543}
[add] https://crrev.com/f3c401c7f25b5dfeb934212ab0934c638855a7ac/build/android/gradle/AndroidManifest.xml
[modify] https://crrev.com/f3c401c7f25b5dfeb934212ab0934c638855a7ac/build/android/gradle/android.jinja
[add] https://crrev.com/f3c401c7f25b5dfeb934212ab0934c638855a7ac/build/android/gradle/cmake.jinja
[modify] https://crrev.com/f3c401c7f25b5dfeb934212ab0934c638855a7ac/build/android/gradle/generate_gradle.py
[modify] https://crrev.com/f3c401c7f25b5dfeb934212ab0934c638855a7ac/build/android/gradle/root.jinja

Comment 2 by wnwen@chromium.org, May 10 2018

Status: Fixed (was: Assigned)
Project Member

Comment 3 by bugdroid1@chromium.org, May 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c216f89f89f3915bcd362fbe341417cacf79fa5a

commit c216f89f89f3915bcd362fbe341417cacf79fa5a
Author: Andrew Grieve <agrieve@chromium.org>
Date: Fri May 18 21:22:52 2018

generate_gradle.py: Set minSdkVersion and targetSdkVersion

Fixes Studio errors about minSdkVersion defaulting to 1.

Bug: 841529
Change-Id: Ic9f029220a2c7d942d198154b72f6aeedcd73a0f
Reviewed-on: https://chromium-review.googlesource.com/1066556
Reviewed-by: Dmitry Skiba <dskiba@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560046}
[modify] https://crrev.com/c216f89f89f3915bcd362fbe341417cacf79fa5a/build/android/gradle/android.jinja
[modify] https://crrev.com/c216f89f89f3915bcd362fbe341417cacf79fa5a/build/android/gradle/generate_gradle.py

Status: Assigned (was: Fixed)
When trying to debug using Android Studio, I got this error.  It seems that the generated AndroidManifest.xml still contains min/maxSdk.  Removing them from that file made the problem go away.
Labels: DevX
Components: Build
@dewittj - Not sure which AndroidManifest.xml you are using. The one used for the _all target does not have min/maxSdk: https://cs.chromium.org/chromium/src/build/android/gradle/AndroidManifest.xml?rcl=d39a30587e08602ffe70c08fd26f93a6be8dd8d5

Are you passing --target?
Project Member

Comment 8 by bugdroid1@chromium.org, Jan 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3cffb80a89e4301ac35e65e3dfc7c4afc139bcd6

commit 3cffb80a89e4301ac35e65e3dfc7c4afc139bcd6
Author: Peter Wen <wnwen@chromium.org>
Date: Wed Jan 09 15:08:12 2019

Android: Remove min/target api in gradle manifest

Newer Android Studio versions explicitly disallow specifying min/target
api versions in the Android Manifest.xml, preferring build.gradle
instead.

Bug: 841529
Change-Id: I0d9c340ea9b762aabbce91bc0067508bef6ff569
Reviewed-on: https://chromium-review.googlesource.com/c/1398398
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621143}
[modify] https://crrev.com/3cffb80a89e4301ac35e65e3dfc7c4afc139bcd6/build/android/gradle/generate_gradle.py
[modify] https://crrev.com/3cffb80a89e4301ac35e65e3dfc7c4afc139bcd6/build/android/gradle/manifest.jinja

Cc: wnwen@chromium.org
Owner: dewittj@chromium.org
Re-assigning to Justin as he's looking into how to make this flow better.

Comment 10 by wnwen@chromium.org, Jan 16 (6 days ago)

Andrew made a good suggestion, simply remove all of min/target lines from all our AndroidManifest.xml files and only have GN know about them, just like Android Studio wants only gradle to know about these settings.

Sign in to add a comment