如何在 IntelliJ IDEA 中添加库 (android-support-v7-appcompat) [英] How do I add a library (android-support-v7-appcompat) in IntelliJ IDEA

查看:53
本文介绍了如何在 IntelliJ IDEA 中添加库 (android-support-v7-appcompat)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个项目,复制了项目中的资源文件,库,添加到项目结构中,规定样式Theme.AppCompat.编译没有错误,但是当你开始降级时出现异常:

I created a project, copied the resource files in the project, library, added it to the project structure, prescribed style Theme.AppCompat. Compiled without errors, but when you start the relegation Exception:

08-03 00:50:00.406: ERROR/AndroidRuntime(4055): FATAL EXCEPTION: main
        java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
        at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:98)
        at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
        at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
        at com.example.SampleMetrRost.CentralActivity.onCreate(CentralActivity.java:12)
        at android.app.Activity.performCreate(Activity.java:4636)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1051)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1924)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985)
        at android.app.ActivityThread.access$600(ActivityThread.java:127)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4476)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:583)
        at dalvik.system.NativeStart.main(Native Method)

请帮帮我.今天花了一整天.

Help me, please. Spent all day today.

推荐答案

Without Gradle (点击此处查看 Gradle 解决方案)

  1. 创建支持库项目.

将您的库项目从 Eclipse 项目导入 Intellij(此步骤仅适用于您在 Eclipse 中创建的库).

Import your library project to Intellij from Eclipse project (this step only applies if you created your library in Eclipse).

右键单击模块并选择打开模块设置.

Right click on module and choose Open Module Settings.

v7 jar 文件的设置库

Setup libraries of v7 jar file

v7 的设置库模块

设置 v7 库模块的应用模块依赖

Setup app module dependency of v7 library module

这篇关于如何在 IntelliJ IDEA 中添加库 (android-support-v7-appcompat)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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