Android Studio执行了错误的文件 [英] Android Studio wrong file executed

查看:79
本文介绍了Android Studio执行了错误的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始通过android培训网站学习在android studio上开发应用程序.我按照步骤操作,并创建了一个空项目.但是我在创建项目时包括了c ++支持.因此,当我运行项目时,输出是native-lib.cpp中的来自c ++的Hello",而不是activity_main.xml中的"Hello World".

I am beginning to learn developing apps on android studio through android training website. I followed the steps and created an empty project. However I included c++ support while creating project. So when i ran the project, the output is "Hello from c++" from native-lib.cpp instead of "Hello World" in activity_main.xml.

我的问题是:

如何获取它以执行activity_main.xml并打印hello world而不是native-lib.cpp?

How do I get it to execute activity_main.xml and print hello world rather than native-lib.cpp?

推荐答案

已解答如果您只是更改XML,但尚未更改新项目的源代码,那么您的XML将被行

If you're just changing the XML, but haven't changed the source code for the new project, then your XML is going to be overridden by the line

tv.setText(stringFromJNI());

删除该行(或在此处设置新文本)以解决您的问题.原因是XML是视图的起点,因此在运行时对该视图进行的所有更改都是您可能会看到的更改.

Remove that line (or set your new text there instead) to fix your issue. It's caused by the fact that the XML is the starting point for your view, so any and all changes to that view during runtime will be the ones that you're likely to see.

这篇关于Android Studio执行了错误的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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