【问题标题】:How can I get HoloEverywhere to work with a new Android project using Gradle?如何让 HoloEverywhere 使用 Gradle 处理新的 Android 项目?
【发布时间】:2013-08-04 20:26:22
【问题描述】:

我正在尝试让 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

【问题讨论】:

    标签: android build gradle android-holo-everywhere


    【解决方案1】:

    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-06-03
      • 1970-01-01
      • 2015-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-15
      • 2020-12-18
      • 1970-01-01
      相关资源
      最近更新 更多