android studio导入android.support.v7,无法在Android Studio中导入android.support.v7.appcompat.R...

我正在尝试在我的应用中使用工具栏。过去我没有遇到任何问题。在我尝试使用此工具栏上的布局,我得到的错误:无法在Android Studio中导入android.support.v7.appcompat.R

java.lang.NoClassDefFoundError: android/support/v7/appcompat/R$attr

at android.support.v7.widget.Toolbar.(Toolbar.java:191)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:422)

at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:413)

at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)

at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:177)

at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:214)

at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:142)

at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:117)

at android.view.LayoutInflater.parseInclude(LayoutInflater.java:858)

at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:802)

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)

at android.view.LayoutInflater.inflate(LayoutInflater.java:504)

at android.view.LayoutInflater.inflate(LayoutInflater.java:385)

at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:413)

at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:321)

at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)

at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:497)

at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:485)

at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)

at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:485)

at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:590)

at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)

at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)

at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)

at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)

at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)

at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)

at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)

at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)

at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

在“Toolbar.java”,该import android.support.v7.appcompat.R;语句失败 - 它说cannot resolve symbol 'R'。我已经尝试重建项目,我有我的build.gradle文件中正确的'编译'依赖项,我已经尝试'文件>无效缓存/重新启动'我不知道什么问题是。这是我的build.gradle文件:

apply plugin: 'com.android.application'

android {

compileSdkVersion 22

buildToolsVersion "22.0.1"

defaultConfig {

applicationId "me.bausware.set"

minSdkVersion 15

targetSdkVersion 22

versionCode 1

versionName "1.0"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:22.2.0'

}

2015-05-30

Alex

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值