0

我试图让 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
4

1 回答 1

0

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

如果它支持 android & gradle,在下载部分应该有一个 aar 链接。要求holo 的开发者将gradle build 上传到maven。

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

于 2013-09-01T21:15:15.007 回答