2017-02-03 72 views
0

我想在我的项目中使用com.android.future.usb.UsbManager;。这个课程附带google api。我创建了一个新的项目,从项目结构的设置(我使用Android工作室),我改变了编译SDK版本谷歌的API(API 19)和构建工具版本19.1.0使用Google API的正确版本版本

我的身材。 gradle文件如下,但我得到了一些错误。

我的问题是:如何才能找到使用Google API(API 19)或Google API(API 17)的正确组合?
哪个构建工具版本(我在UI中都尝试过)?

Error:(9) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'."

Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt

compileSdkVersion 'Google Inc.:Google APIs:19' 
buildToolsVersion '19.1.0' 
defaultConfig { 
    applicationId "com.example.cihan.myapplication" 
    minSdkVersion 10 
    targetSdkVersion 19 
    versionCode 5 
    versionName "5.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 

编辑:我重新安装的Android Studio和选择最新的谷歌API的版本和构建版本(两个版本现在24)

+0

你为什么不使用只是最新的一个? –

+0

gui中的最大可用值是Google API(API 19),如果我同时选择最大可用值,则最大可用构建工具版本为24.0.3。 – Cozdemir

回答

1

Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'."

您需要编译的程序兼容性库

dependencies { 
    compile 'com.android.support:appcompat-v7:19+' 
} 

注意:我只使用版本19+,因为这似乎是你想要编译。这是2014年发布的,所以我建议升级。

您可以编译使用最新的SDK,并仍然在设备上运行的API(大多数)代码19

见 - Android Material Design | Maintaining Compatibility

+0

我改变了构建版本到24.0.3(最大我可以在gui中选择)并添加了编译'com.android.support:appcompat-v7:25.1.1' 但我仍然得到相同种类的错误。还我改变的build.gradle像下面 compileSdkVersion '谷歌Inc.:Google的API:19' buildToolsVersion '24 .0.3' defaultConfig { 的applicationID “com.example.cihan.myapplication” 的minSdkVersion 19 targetSdkVersion 24 的versionCode 5 versionName“5.0” testInstrumentationRunner“android.support.test.runner.AndroidJUnitRunner” } – Cozdemir

+0

我不认为buildToolsVersion应该大于compileSdkVersion。与targetSdkVersion相同。如果您无法选择较高的号码,则需要从SDK Manager中安装 –

+0

我将立即更新并重试。你能否给我举一个例子你的配置。例如谷歌API版本buid版本,并编译'com.android.support:appcompat-v7:19+'属性。 – Cozdemir