运行 .apk 时,Android Studio 获取包名称错误 [英] Android Studio gets package name wrong when running .apk

查看:42
本文介绍了运行 .apk 时,Android Studio 获取包名称错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将包名称从 com.mycompany.myapplication 更改为 com.mycompany.testapp.

I changed my package name from com.mycompany.myapplication to com.mycompany.testapp.

一切都很好,但是当我尝试在模拟器上运行它时,我得到:

Everything builds fine but when I try to run it on the emulator, I get:

会话已重新启动目标设备:NexusS [emulator-5554]上传文件本地路径:/home/antony/AndroidStudioProjects/testappProject/testapp/build/apk/testapp-debug-unaligned.apk远程路径:/data/local/tmp/com.mycompany.myapplication安装 com.mycompany.myapplication设备外壳命令:pm install -r "/data/local/tmp/com.mycompany.myapplication"包:/data/local/tmp/com.mycompany.myapplication成功

The session was restarted Target device: NexusS [emulator-5554] Uploading file local path: /home/antony/AndroidStudioProjects/testappProject/testapp/build/apk/testapp-debug-unaligned.apk remote path: /data/local/tmp/com.mycompany.myapplication Installing com.mycompany.myapplication DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.mycompany.myapplication" pkg: /data/local/tmp/com.mycompany.myapplication Success

启动应用程序:com.mycompany.myapplication/com.mycompany.testapp.MainActivity.设备外壳命令:am start -D -n "com.mycompany.myapplication/com.mycompany.testapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER开始: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mycompany.myapplication/com.mycompany.testapp.MainActivity }错误类型 3错误:活动类 {com.mycompany.myapplication/com.mycompany.testapp.MainActivity} 不存在.

Launching application: com.mycompany.myapplication/com.mycompany.testapp.MainActivity. DEVICE SHELL COMMAND: am start -D -n "com.mycompany.myapplication/com.mycompany.testapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mycompany.myapplication/com.mycompany.testapp.MainActivity } Error type 3 Error: Activity class {com.mycompany.myapplication/com.mycompany.testapp.MainActivity} does not exist.

注意远程路径^^^是错误的.

Note the remote path ^^^ is wrong.

如果我进入模拟器,我可以从菜单启动应用程序,只是当我尝试从 Android Studio 运行应用程序时出现此错误.

If I go to the emulator, I can start the app from the menu, it's just that I get this error when i try to run the app from Android Studio.

我还在 logcat 中看到,在右上角,下拉菜单为我提供了无过滤器"或app:com.mycompany.myapplication".所以我什至无法正常调试.

I also see in logcat, on the top-right, the drop-down offers me "No Filters" or "app:com.mycompany.myapplication". So I can't even debug properly.

这些对 com.mycompany.myapplication 的引用来自哪里,我该如何解决?

Where are these references to com.mycompany.myapplication coming from, and how can I fix this?

推荐答案

我会回答,以防其他人遇到这个问题.奇怪的是,重新启动 Android Studio 解决了这个问题.没有更复杂的,也没有更明显的.

I'll answer, just in case anyone else gets stuck with this. Strangely enough, restarting Android Studio solved the problem. Nothing more complicated, nothing less obvious.

这篇关于运行 .apk 时,Android Studio 获取包名称错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆