【问题标题】:Class referenced in the manifest was not found in the project or the libraries在项目或库中找不到清单中引用的类
【发布时间】:2015-02-16 01:56:47
【问题描述】:

最近我尝试删除所有 lint 问题,但在清单中出现了一个问题:
“在项目或库中找不到清单中引用的类 com.octo.android.robospice.JacksonSpringAndroidSpiceService”

    <service
        android:name="com.octo.android.robospice.JacksonSpringAndroidSpiceService"
        android:exported="false" >
    </service>

这是一个 maven 依赖,也包含在 build.gradle 文件中:

dependencies {
  ...
    compile 'com.octo.android.robospice:robospice:1.4.11'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.11'
   ...
}

还有什么办法可以解决这个 lint 警告,还是我必须取消它?

【问题讨论】:

    标签: java android maven gradle


    【解决方案1】:

    在我的情况下,我忘记在 kotlin 文件中添加包

    package com.user.examplephone;
    

    【讨论】:

      【解决方案2】:

      我知道这是一个老问题,但我今天遇到了类似的问题。问题出在服务的名称上。如果你的项目中有这个类,那么名称应该是:

        <service
              android:name="YOUR_PACKAGE.YOUR_CLASS_NAME"
              android:exported="false" />
      

      【讨论】:

        【解决方案3】:

        转到文件->使现金无效并重新启动

        对我有用

        【讨论】:

        【解决方案4】:

        例子:

                    android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
                    android:screenOrientation="portrait"
                    android:theme="@style/LicensesTheme"
                    tools:ignore="MissingClass"/>
        
        
        

        你需要添加

        tools:ignore="MissingClass"
        

        【讨论】:

        • 这有助于消除错误.. 但是没有调用类中的函数:(
        【解决方案5】:

        在我的情况下,在清除 SO 以寻求解决方案之后。最后,我将 MainActivity 的完全限定路径名放在清单中,并且缓存无效,然后重新启动。为我工作。 YMMV

        【讨论】:

        • 如何在 manifest 中为 MainActivity 找到合适的路径?
        猜你喜欢
        • 1970-01-01
        • 2021-01-27
        • 2022-11-15
        • 1970-01-01
        • 1970-01-01
        • 2021-08-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多