简体   繁体   中英

Can't build android project because ActionBarActivity cannot be resolved to a type

I'm following the training on the developer.android.com site and when I arrived at the Building your first app / Starting another activity section I failed:

I've added the android-support-v7-appcompat library according to this site describes: http://developer.android.com/tools/support-library/setup.html#libs-with-res

Where I select the libraries for an android project (Properties of the project / Android / Library) I clicked the add button, selected the project library (first picture), and after I pressed ok the project didn't build.

Before (everything is ok) 点击确定之前

After 不知何故,当我打开窗户时,它失败了。

Before all this... I was somehow able to build the project, press the Play, but it unfortunately stopped (crashed) on my device immediately after starting. And the console said:

[2014-07-23 15:06:45 - android-support-v7-appcompat] Could not find android-support-v7-appcompat.apk!

and that was the point when I started investigating the problem... yet unsuccessfully.

My question is, why "deactivating" the library after I check again?

The library project should be placed on the same drive with your workspace. the referencing project was in the same eclipse workspace as the library project.

您应该复制appcompat-v7并将其放在工作区中,然后让所有项目引用它。

I had the same problem : using GIT, my project was located on a server :

 \\\\BOB\\Volume_1\\GIT\\Android\\ICS 

So i had to create a clone of my GIT repository on the same drive than my worspace :

 D:\\WSpaces\\Android -> my workspace where is located android-support-v7-appcompat D:\\WSpaces\\GIT -> the GIT clone repository 

I probably could have shared the android-support-v7-appcompat on my repository, not tested...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM