简体   繁体   English

LibGDX无法在Android API 21上运行吗?

[英]LibGDX not work on Android API 21?

I have Android API 21 and 20. But libgdx not work in 21! 我有Android API 21和20。但是libgdx在21中不起作用! Last version libgdx work with API 20. But when I build project with API 20, Eclipse return error: 最新版本的libgdx可使用API​​20。但是当我使用API​​ 20构建项目时,Eclipse返回错误:

"appcompat_v7/res/values-v21/themes_base.xml:191: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'."

I finded more answers about this, but everybody tell what you need use API 21. 我找到了更多有关此问题的答案,但每个人都可以使用API​​ 21告诉您需要什么。

Appcompat v7 and ActionBarActivity Appcompat v7和ActionBarActivity

What me do? 我怎么办

PS Sorry for my English! PS对不起,我的英语!

Since I was in a similar situation a couple of days back, I think the following might work(assuming you're using BaseGameUtils in your project, or any module that uses appCompat) 由于几天前我处于类似情况,所以我认为以下方法可能有效(假设您在项目中使用BaseGameUtils或任何使用appCompat的模块)

  1. Open the project in Android Studio 在Android Studio中打开项目
  2. Double click on the build.gradle file of the module which uses appCompat(for me, it was BaseGameUtils) 双击使用appCompat的模块的build.gradle文件(对我来说是BaseGameUtils)
  3. change the dependencies as following(sorry for the bad formatting, I'm in a hurry): 更改依赖项如下(对格式错误,很抱歉,我很着急):

    dependencies { compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:support-v4:20.0.+' compile 'com.google.android.gms:play-services:+' } 依赖项{编译'com.android.support:appcompat-v7:22.0.0'编译'com.android.support:support-v4:20.0.+'编译'com.google.android.gms:play-services:+' }

    android { compileSdkVersion 22 buildToolsVersion '22.0.1' } android {compileSdkVersion 22 buildToolsVersion '22 .0.1'}

    This is the because these values are the latest at the time of this writing. 这是因为这些值在撰写本文时是最新的。

  4. Double click on build.gradle of the android module and change the values of the compileSdkVersion and buildToolsVersion to the values given above. 双击android模块的build.gradle并将compileSdkVersion和buildToolsVersion的值更改为上面给出的值。

  5. Save, sync with gradle, clean the project and rebuild it. 保存,与gradle同步,清理项目并重建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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