通过gradle
我的错误是
error: package org.holoeverywhere.app does not exist
import org.holoeverywhere.app.Activity;
我有以下结构:
MySimpleProject
-SimpleApp
--build.gradle
-settings.gradle
-build.gradle
我的SimpleApp
取决于HoloEverywhere图书馆。
build.gradle
的 MySimpleProject
是
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
来自setting.gradle
的 MySimpleProject
是
include ':SimpleApp'
来自build.gradle
的 SimpleApp
apply plugin: 'android'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile 'org.holoeverywhere:library:1.6.1'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
}
日志
./gradlew build
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:SimpleApp:prepareDebugDependencies
:SimpleApp:compileDebugAidl UP-TO-DATE
:SimpleApp:generateDebugBuildConfig UP-TO-DATE
:SimpleApp:mergeDebugAssets UP-TO-DATE
:SimpleApp:compileDebugRenderscript UP-TO-DATE
:SimpleApp:mergeDebugResources UP-TO-DATE
:SimpleApp:processDebugManifest UP-TO-DATE
:SimpleApp:processDebugResources UP-TO-DATE
:SimpleApp:compileDebug
/home/oleg/AndroidStudioProjects/MySimpleProject/SimpleApp/src/main/java/com/example/mysimpleapp/LoginActivity.java:19: error: package org.holoeverywhere.app does not exist
import org.holoeverywhere.app.Activity;
有人能帮助我吗?
答案 0 :(得分:3)
此repo包含生成的aar格式,只需添加:
repositories {
maven {
url 'https://github.com/Goddchen/mvn-repo/raw/master/'
}
mavenCentral()
}
到您的gradle存储库并添加:
dependencies {
compile "org.holoeverywhere:holoeverywhere:1.6.8"
}
答案 1 :(得分:1)
此库仅作为gradle插件不支持的apklib发布。
答案 2 :(得分:1)
Android Studio:在build.gradle依赖项中复制并粘贴它:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
答案 3 :(得分:0)
受this answer的启发,这些是我所做的步骤:
将jar文件(在我的情况下,'something.jar')放入项目的libs文件夹中
右键单击它并选择Add as library
在build.gradle文件的依赖项部分中键入:compile files('libs/something.jar')
做一个干净的构建。它可以在android studio中完成,但我也运行了项目文件夹中包含的gradlew.bat
现在,该项目应该建立并运行得很好。