Skip to content

x/mobile/cmd/gomobile: bind generates bad android manifest.xml; missing minSdk #12661

@Qubitium

Description

@Qubitium

Env

gomobile version +ef84e05 Thu Sep 17 03:25:18 2015 +0000 (android);
android studio 1.4b4

Problem

Gobind plugin generated aar library have minSdk missing from the generated manifest.xml resulting in READ_PHONE_STATE permission inserted into apk build result even when this permission is not specified anywhere.

When android studio/gradle merges the aar libary manifest with app's manifest.xml, it will notice the golib aar library's minSdk is missing and assume some weird default settings and insert a READ_PHONE_STATE permission in the final merged manifest even when the app manifest doesn't use or specify this permission.

<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />

Fix

Line 162 of bind_androidapp.go

const manifestFmt = `<manifest xmlns:android="http://schemas.android.com/apk/res/android" package=%q/>`

Should be as follows or similar with minSdk specified:

const manifestFmt = `<manifest xmlns:android="http://schemas.android.com/apk/res/android" package=%q><uses-sdk android:minSdkVersion="7"/></manifest>`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions