adelphes / android-dev-ext

Android debugging support for VS Code
https://marketplace.visualstudio.com/items?itemName=adelphes.android-dev-ext
MIT License
207 stars 28 forks source link

Allow product flavors #76

Open Pedroalexandrelopes opened 4 years ago

Pedroalexandrelopes commented 4 years ago

Hi. I have an AndroidStudio project with product flavors defined in the gradle file for staging and production environments. Each flavor defines its own applicationId.

I have the args defined with 'assembleStagingDebug' in tasks.json so it can gradlew with the selected flavor profile.

When the debugger is trying to launch the MainActivity, it uses the defaultConfig applicationId/packageName to search for it. It ends with the error "Launch failed: Error: Activity class {(packageName)/(MainActivity)} does not exist."

I can see the source code uses the command to launch activity 'am start' with the 'this.session.build.pkgname'. Is it possible to have a launch configuration to specify the pkgname or any other way of searching the correct package of the flavor used?

adelphes commented 4 years ago

The latest version of the debugger now attempts to extract the manifest directly from the built APK and uses the source file as a fallback. This should fix this issue, but I will there needs to be some more testing around different gradle configurations and property overrides.