模块清单中的应用程序类 [英] Application class in a module's manifest

查看:73
本文介绍了模块清单中的应用程序类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中添加了一个模块,并创建了一个Application类,该类已添加到该模块的清单中.

I have added a module within my project and created an Application class which was added to the module's manifest.

public class App extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());;
    }
}

清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mymodule">

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:name="com.example.mymodule.App">
    </application>

</manifest>

问题是,尝试在清单中设置应用程序类的名称时没有任何建议.有什么想法吗?

The problem is that I get no suggestions when trying to set the name of my application class within the Manifest. Any ideas why?

我的应用程序模块中已经有一个应用程序类.之所以这样做,是因为我想在该模块中添加一个库.我该如何实现?

I already have an Application class in my app module. The reason why I'm doing this is because I want to add a library in that module. How can I achieve this?

推荐答案

如果您的应用程序类在任何包中,则名称为.[程序包名称].[应用程序类].如果它在任何程序包之外,则仅是应用程序名称.如果问题仍然存在,请重新启动Studio同步,重新生成并清理它,然后再次检查.希望这对您有所帮助.

If you application class is within any package then the name will be .[package name].[Application class]. If it is outside the any package the just the Application name.If still the problem exist then restart the studio sync,rebuild and clean it and check it once again.Hope this will help you.

这篇关于模块清单中的应用程序类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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