最近在 使用AndroidStudio時突然出現(xiàn)了Error:Failed to find target with hash string 'Google Inc.:Google APIs:23' 的錯誤,導(dǎo)致整個Project中的所有module項目都報錯了,剛開始時以為是API23沒有下載,通過SDK Manager下載了版本為23的API以后同步Gradle后還是報相同的錯誤。后來終于在維基百科上面找到了原因。原來是Windows和Mac平臺的問題,如下圖所示,
關(guān)于圖片中的鏈接:http://stackoverflow.com/questions/35450417/errorcause-failed-to-find-target-with-hash-string-google-inc-google-apis23
如圖中所示:Google Inc.:Google APIs:23 是在Ubuntu系統(tǒng)中,? 在Windows中是compileSdkVersion 'Google Inc.:Google APIs:23';
圖中也給出了具體的解決方法,把對應(yīng)的Gradle中的Google Inc.:Google APIs:23改為Google Inc.:Google APIs:23。如果project或者module過多不好找的話,直接在AndroidStudio界面中全局搜索Google Inc.:Google APIs:23然后替換(因為我的AS中的keymaps是使用Eclipse ADT的配置,所以全局搜索就是Ctrl + h 鍵)。
后來仔細想了想,主要原因可能是下載或者復(fù)制了別人的項目,然后用AS打開導(dǎo)致的坑,或者是其他的原因?qū)е碌摹?傊业浇鉀Q的方法才是最重要的。