zoukankan      html  css  js  c++  java
  • 只不过是路径配置的错误出错信息:Unable to instantiate activity ComponentInfo{com.yeqing.ordermeal/com.yeqing

    出错信息:Unable to instantiate activity ComponentInfo{com.yeqing.ordermeal/com.yeqing

    出错原因:activity路径注册错误

    原来设计时的activity是放在默认的文件夹com.yeqing.orderMeal下面的

    今天由于架构的需要,在默认的文件夹com.yeqing.orderMeal下分别加了三个包 admin normal common

    后来run这个程序的时候,前台报错说应用终止,后台报错说:

    Unable to instantiate activity ComponentInfo{com.yeqing.ordermeal/com.yeqing..........后面一大堆....

    检查程序代码,没错啊。。

    后来在AndroidManifest.xml里发现,Activity注册的路径还是原来的那个,即是:

            <activity
                android:name="com.yeqing.ordermeal.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

    注册的配置文件并没有因为我修改了java文件的路径自动为我修改注册路径,还是原来那个。好吧,我只能一个个的对应着修改一下已有Activity的路径。

    修改如下:

             <activity
                android:name="com.yeqing.ordermeal.common.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

     这样一来,就OK啦。

     备注:不仅可以直接使用绝对路径配置,也可以改为相对路径.MainActivity

  • 相关阅读:
    链表--判断一个链表是否为回文结构
    矩阵--“之”字形打印矩阵
    二叉树——平衡二叉树,二叉搜索树,完全二叉树
    链表--反转单向和双向链表
    codeforces 490C. Hacking Cypher 解题报告
    codeforces 490B.Queue 解题报告
    BestCoder19 1001.Alexandra and Prime Numbers(hdu 5108) 解题报告
    codeforces 488A. Giga Tower 解题报告
    codeforces 489C.Given Length and Sum of Digits... 解题报告
    codeforces 489B. BerSU Ball 解题报告
  • 原文地址:https://www.cnblogs.com/avivaye/p/2972908.html
Copyright © 2011-2022 走看看