Unable to test app after upgrading to Lollipop

2019-01-22 01:17发布

I am using Android Studio to develop my apps.

Since I upgraded my HTC One M8 to Lollipop, I can not use it to test my apps by "Run app" in Android Studio. I get this error and nothing happens on my phone:

Launching application: com.project.GalleryActivity.
DEVICE SHELL COMMAND: am start -n "com.project.GalleryActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String android.os.SystemProperties.native_get(java.lang.String) (tried Java_android_os_SystemProperties_native_1get and Java_android_os_SystemProperties_native_1get__Ljava_lang_String_2)
at android.os.SystemProperties.native_get(Native Method)
at android.os.SystemProperties.get(SystemProperties.java)
at com.htc.customization.HtcCustomizationManager.<init>(HtcCustomizationManager.java)
at com.htc.customization.HtcCustomizationManager.<clinit>(HtcCustomizationManager.java)
at android.os.Environment$UserEnvironment.getCustomizationReader(Environment.java)
at android.os.Environment$UserEnvironment.isDynamicSwitchSupported(Environment.java)
at android.os.Environment$UserEnvironment.<init>(Environment.java)
at android.os.Environment.initForCurrentUser(Environment.java)
at android.os.Environment.<clinit>(Environment.java)
at android.os.Environment.getLegacyExternalStorageDirectory(Environment.java)
at android.os.Debug.<clinit>(Debug.java)
at android.ddm.DdmHandleHello.handleHELO(DdmHandleHello.java)
at android.ddm.DdmHandleHello.handleChunk(DdmHandleHello.java)
at org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java)
java.lang.UnsatisfiedLinkError: android.os.Debug
at android.ddm.DdmHandleHello.handleFEAT(DdmHandleHello.java)
at android.ddm.DdmHandleHello.handleChunk(DdmHandleHello.java)
at org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java)
java.lang.UnsatisfiedLinkError: android.os.Debug
at android.ddm.DdmHandleProfiling.handleMPRQ(DdmHandleProfiling.java)
at android.ddm.DdmHandleProfiling.handleChunk(DdmHandleProfiling.java)
at org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java)
Aborted

My project's settings are these:

Project's settings

This technique used to work perfectly before upgrading and I have not change anything since that time.

11条回答
走好不送
2楼-- · 2019-01-22 01:36

I met the same problem on ASUS ME176C(Lollipop 5.0),
but I resolved it by setting "Select debug app" to "No". Then push apk as usual. After that, you can reselect "debug app" to target app.

查看更多
戒情不戒烟
3楼-- · 2019-01-22 01:37

I've had a reasonable amount of success with the workaround below.

After each debugging session with your app, go to the Android Studio terminal:

> adb shell am force-stop com.your.app.package

I still occasionally get the java.lang.UnsatisfiedLinkError but only following the above command rather than in between the build/push apk/install process and attempting a debugging session.

To me, this saves a lot of wasted time building only to get the error. If the command above doesn't work, just up-arrow and re-run the command until it works without an error.

查看更多
孤傲高冷的网名
4楼-- · 2019-01-22 01:38

This solution worked for me, you may give it a try.

Add adb path to System Environment Variables (I'm using windows 8)
Ex: my path is "C:\Users\xxx\AppData\Local\Android\sdk\platform-tools"
Dont forget to reboot your system to take the effect!

About how to set the path and environment variables in Windows >> here

查看更多
放荡不羁爱自由
5楼-- · 2019-01-22 01:40

I discovered a "workaround" to solve this problem

Find the HTC Blink Home Launcher and uninstall the update

(CAUTION:uninstall the launcher update will remove all icons and widgets placed on the launcher)

This works for me and it can be used debugging now without removing the apps in multitask. This should be a bug caused by HTC? (I am using HTC Butterfly 2 & Android 5.0.2)

查看更多
对你真心纯属浪费
6楼-- · 2019-01-22 01:40

On my HTC M8, I resolved the issue by disabling "Settings -> Developer options -> Use NuPlayer(experimental)"

What I have noticed is, when I try to run the application I created long back (few years ago), I have to disable the NuPlayer. However, with new applications, I must keep the option checked.

Hope this helps....

查看更多
混吃等死
7楼-- · 2019-01-22 01:43

I don't have the rep for commenting but i was in the same situation of @user47625 but my "Verify Apps over USB" was already off. I've tried to enlarge a bit this answer with some reasoning.

At first I've tried to change the launcher and I got some luck but was hit and miss, not a proper solution. Rebooting the phone granted a couple of hours of calm work.

Then i've found someone on google that stated:

If it is that bug: The DDMS client connects with a "Hello" when the PM process first starts and registers itself, but before it has fully initialized all the native code. It is a race in stock Android and occurs there too

So if this race occurs it doesn't occurs everytime, but every now and then, I suspect something regarding interaction of item on Android. I don't know if it's CPU, RAM or App related, but on my Zenfone 2 closing all background apps (1) and releasing the memory (2) does the trick, letting me able to debug the app properly.

I used Clean Master cause is stock with Zenfone 2, but i suspect every memory manager can do that. Give it a try

查看更多
登录 后发表回答