Search code examples
androidvisual-studiodebuggingadb

Visual Studio 2015 / 2017 unable to debug Android Application on Android 8.0 devices


I have been using Visual Studio 2015 / 2017 for Android application development for few years. I can deploy and debug my android apps on an Android 7.0 device without any problem. However, right after I upgraded my phone to Android 8.0, the deploy / debug operation failed with the following error message:

Could not install application 'com.omnigsoft.gameenginedemo' (my apk file path ...) on the device 'CJL5T16107010699'. Installation succeeded but the applications was not found on the device.

My android app is actually installed on the device successfully (I can start it on device manually) but it seems like that Visual Studio can not list and find the installed app (by ADB shell / pm list command), as the result, I'm unable to start debugger to debug my app on Android 8.0 device.

I notice there was another developer reported the same problem but got no answer. I'm frustrated by this right now, many thanks for any suggestions!


Solution

  • I finally solved the problem.

    It turns out that this is an obvious bug in VS 2015 and VS 2017 (version 15.5). Luckly, VS team has fixed this bug in the latest version so the simple solution is update VS with the latest version 15.7 update 2 (aka 15.7.2) from the official site: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Professional&rel=15#

    Interestingly, here is what I found the bug is, in VS 2017 earlier versions, create a simply Android app named "Android1", when build and deploy to an Android 7 device, the app package is installed as:

    package:/data/app/com.Android1-1/base.apk=com.Android1

    When deploy to an Android 8 device, the package is istalled as:

    package:/data/app/com.Android1-GLGROUzYL85gF8mDWG9J6A==/base.apk=com.HelloAndroid1

    Oviously the strange surffix "GLGROUzYL85gF8mDWG9J6A==" appended after the installed folder make VS unable to detect the installed app package, then it reports deployment failure.

    I use ADB command "adb shell pm list packages -f -3" to list installed apps on device, I guess VS does the same thing. Anyway, it is fixed in VS 15.7.2. Cheers!

    Update: The app package installation path still contains sort of encrypted string on Android 8 deivce, buy VS now can detect the app package anyway.