問(wèn)題描述
這個(gè)應(yīng)用程序是我大約一年前完成的(!),但從未在市場(chǎng)上推出過(guò).我現(xiàn)在正在嘗試在 Eclipse 中打開(kāi)它,以進(jìn)行一些小的修改并稍微處理代碼.所以我導(dǎo)入了它,然后發(fā)現(xiàn)這個(gè)奇怪的無(wú)法解析目標(biāo)"錯(cuò)誤.它突出顯示了我所有src"文件中的每個(gè)類紅色.
This app I completed around a year ago (!) but never launched it on the market place. I am trying to open it up in eclipse now to make some small modifications and work on the code a little bit. So I imported it and then found this weird "unable to resolve target" error. It's highlighting every class red in all my 'src' files.
我看過(guò)一個(gè)類似的問(wèn)題,它說(shuō)要將該行添加到 default.properties 文件中.我的項(xiàng)目有一個(gè) project.properties 文件,其中包含以下行:
I've looked at a similar question which said to add the line to default.properties file. My project has a project.properties file which has the line:
target=android-7
任何建議如何讓它工作?我總是可以開(kāi)始一個(gè)新項(xiàng)目并復(fù)制所有的 src 文件,但這會(huì)很蹩腳且浪費(fèi)時(shí)間.
Any advice how to get this to work? I could always start a new project and just copy all the src files but that would be pretty lame and time-wasting.
還有一條評(píng)論 - 我正在一臺(tái)新計(jì)算機(jī)上進(jìn)行開(kāi)發(fā),但我認(rèn)為我沒(méi)有 API 級(jí)別 7.這可能是問(wèn)題嗎?我已經(jīng)進(jìn)入了 Window --> Android SDK Manager,它顯示的最舊的可用 API 是 8 級(jí).但 7 級(jí)意味著我可以針對(duì)更多設(shè)備,所以我想使用它.
One more comment - I'm developing on a new computer and I don't think I have the API level 7. Could that be the problem? I've gone into Window --> Android SDK Manager and the oldest available API it shows is level 8. But level 7 will mean I can target more devices I think so I'd like to go with that.
感謝您的幫助.
推薦答案
嗯,是的,這就是你的問(wèn)題.您沒(méi)有下載 API 級(jí)別 7.您可以右鍵單擊該項(xiàng)目并轉(zhuǎn)到屬性-> android 并選擇另一個(gè)可用的 API.只要您不更改清單中的 min sdk 版本,您的目標(biāo)設(shè)備仍然與以前一樣多.
Well, yes that is your problem. You don't have the API level 7 downloaded. You can right click the project and go properties->android and select another available API. As long as you don't change the min sdk version in your manifest you are still targeting as many devices as before.
<uses-sdk android:minSdkVersion="7"/>
更新
您不必這樣做,但您可以在 SDK 存檔上獲取較舊的 API頁(yè)面
You don't have to do this, but you can get the older APIs on the SDK Archives page
我不知道下一個(gè)聲明是否有任何官方來(lái)源,但這是我在工作時(shí)發(fā)現(xiàn)的.如果有人能以更好的答案完成此任務(wù),我將不勝感激.
I don't know if there is any official source for the next statement but that is what I found while working. If anybody can complete this with a better answer I would appreciate it very much.
只要不使用任何與之前版本不兼容的代碼,您就可以使用較新的 SDK 版本編譯代碼.
You can compile the code with a newer SDK version as long as you don't use any code not compatible to the previous ones.
例子:
我希望我的應(yīng)用可用于 API 級(jí)別 7.但我只安裝了 API 級(jí)別 15.只要我在 Manifest 中保留 minSdkVersion="7" 并且不使用以前 API 中不可用的任何資源,該應(yīng)用程序就可以在我的目標(biāo)設(shè)備上正常運(yùn)行.
I want my app to be available for API level 7. But i only have API level 15 installed. As long as I keep the minSdkVersion="7" in my Manifest and don't use any resource not available in the previous APIs the app will work just fine on my targeted devices.
這篇關(guān)于導(dǎo)入項(xiàng)目給 Unable to resolve target 'android-7'的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!