android - 如何使用Gradle使HoloEverywhere与新的Android项目一起使用?

标签 android build gradle android-holo-everywhere

我正在尝试让HoloEverywhere与我的HelloWorld Android项目一起使用,但是并没有取得太大的成功。我曾尝试使用Android Studio构建它,但放弃了使用更简单的命令行方法。但是,我仍然遇到错误。请参阅下面的“gradle.build”文件和尝试执行干净构建的错误。

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile 'com.google.android:support-v4:r13'
    compile 'org.holoeverywhere:library:1.6.8'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 16
    }
}

和命令行日志:
firefly:HelloWorldProject rodrigo$ ./gradlew clean build
:HelloWorld:clean
:HelloWorld:prepareDebugDependencies
:HelloWorld:compileDebugAidl
:HelloWorld:generateDebugBuildConfig
:HelloWorld:mergeDebugAssets
:HelloWorld:compileDebugRenderscript
:HelloWorld:mergeDebugResources
:HelloWorld:processDebugManifest
:HelloWorld:processDebugResources
:HelloWorld:compileDebug
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:12: package org.holoeverywhere.app does not exist
import org.holoeverywhere.app.Activity;
                             ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:14: cannot find symbol
symbol: class Activity
public class DisplayMessageActivity extends Activity {
                                            ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:9: package org.holoeverywhere.app does not exist
import org.holoeverywhere.app.Activity;
                             ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:11: cannot find symbol
symbol: class Activity
public class MainActivity extends Activity {
                                  ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:18: cannot find symbol
symbol  : variable super
location: class com.example.helloworld.DisplayMessageActivity
        super.onCreate(savedInstanceState);
        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:23: cannot find symbol
symbol  : method getIntent()
location: class com.example.helloworld.DisplayMessageActivity
        Intent intent = getIntent();
                        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:26: cannot find symbol
symbol  : constructor TextView(com.example.helloworld.DisplayMessageActivity)
location: class android.widget.TextView
        TextView textView = new TextView(this);
                            ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:30: cannot find symbol
symbol  : method setContentView(android.widget.TextView)
location: class com.example.helloworld.DisplayMessageActivity
        setContentView(textView);
        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:16: method does not override or implement a method from a supertype
    @Override
    ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/DisplayMessageActivity.java:39: cannot find symbol
symbol  : method getActionBar()
location: class com.example.helloworld.DisplayMessageActivity
            getActionBar().setDisplayHomeAsUpEnabled(true);
            ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:17: cannot find symbol
symbol  : variable super
location: class com.example.helloworld.MainActivity
        super.onCreate(savedInstanceState);
        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:18: cannot find symbol
symbol  : method setContentView(int)
location: class com.example.helloworld.MainActivity
        setContentView(R.layout.activity_main);
        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:15: method does not override or implement a method from a supertype
    @Override
    ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:30: cannot find symbol
symbol  : constructor Intent(com.example.helloworld.MainActivity,java.lang.Class<com.example.helloworld.DisplayMessageActivity>)
location: class android.content.Intent
        Intent intent = new Intent(this, DisplayMessageActivity.class);
                        ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:31: cannot find symbol
symbol  : method findViewById(int)
location: class com.example.helloworld.MainActivity
        EditText editText = (EditText) findViewById(R.id.edit_message);
                                       ^
/Users/rodrigo/Documents/workspace/tutorials/android/HelloWorldProject/HelloWorld/src/main/java/com/example/helloworld/MainActivity.java:34: cannot find symbol
symbol  : method startActivity(android.content.Intent)
location: class com.example.helloworld.MainActivity
        startActivity(intent);
        ^
16 errors
:HelloWorld:compileDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':HelloWorld:compileDebug'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 17.279 secs

最佳答案

org.holoeverywhere似乎没有android存档:
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.holoeverywhere%22

在下载部分,如果它支持android&gradle,则应该有一个aar链接。要求各地的holo开发人员将gradle构建上传到Maven。

他们在github上的解决方案似乎正在克隆git repo:
https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE#android-studio--intellij-idea

关于android - 如何使用Gradle使HoloEverywhere与新的Android项目一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18047241/

相关文章:

android - 在 Android Canvas 下动画形状的最佳实践

android - 如何在 Mac OSX 中为 PhoneGap Build 生成签名 keystore 文件?

c++ - Codelite 程序将无法运行

visual-studio - Docker 镜像在 Windows/MVC 核心上构建的速度很慢

groovy - GPars paralell写,什么时候写所有文件?

Android 启动失败

android - 选择和取消选择单选按钮

c++ - 调试构建编译比发布慢得多

android - 使用 javafx 和 apache POI 的项目在 dex 期间出错

android - react native : Generating the Release Build APK error :app:mergeReleaseAssets FAILED