安卓开发中遇到的小问题

一、

You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法

 

报错如下:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test2/com.example.test2.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

解决方法:
创建的activity是MainActivity extends ActionBarActivity这样的。把后面的ActionBarActivity改成Activity,然后导包,把下面报错的地方删掉运行就不会了。

在高版本的adt中,会继承于ActionBarActivity,若是需要改变主题,则需要改变继承于activity。

二、 Installation error: INSTALL_FAILED_VERSION_DOWNGRADE  出现这个问题

最近折腾了一下Robotium自动化测试框架,发现问题还挺多,刚刚解决了一个问题,总算是把环境搞定了,可是一运行测试用例,发现又报Installation error INSTALL_FAILED_VERSION_DOWNGRADE错误了。网上查了一下,说是AndroidManifest.xml的versionCode有点儿小了,应该改大一点儿就行了。默认是如下的:

 package="com.test.apppage"

      android:versionCode="1"

    android:versionName="1.0"

问题出现在低版本无法发布替换安装高版本。有可能你上一个测试版本version为高版本,下一个测试你调成了低版本。故而低版本无法替换安装高版本。

原文地址:https://www.cnblogs.com/zhenghongxin/p/4252099.html