将 Holoeverywhere 添加到 Android Studio 中的项目 [英] Add Holoeverywhere to project in Android Studio

查看:28
本文介绍了将 Holoeverywhere 添加到 Android Studio 中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Gradle 和 Android Studio(基于 Intellij Idea 的 IDE)的新手.我的问题是纠正 import holoeverywhere 进行投影.我阅读了许多类似的主题,但他们没有为我的问题提供解决方案.

相似主题:

并使用 HoloEverywhere 库中的类更改所有导入、资源(布局)和覆盖方法以忽略 ClassCastException.

享受:)

I'm new in Gradle and Android Studio(Intellij Idea based IDE). My problem is to correct import holoeverywhere to project. I read many similar topics but they dign't give my solution on my problem.

Similar topics:

Android Studio not working with HoloEverywhere and ActionBarSherlock

Building Android Studio project with HoloEverywhere fails

How do I add a library project to Android Studio?

Below put screens of my method of operation:

1 First create new project from scratch

2 Create directory for libs

3 Import new module

4 Import holoeverywhere using Maven model

5 Import settings

6 Add dependencies to main application module

7 Move Holoeverywhere dir to libraries

8 Change parent module name

9 Add dependence to gradle files

10 Change imports in Activity

11 Run result

12 Another attempt to set dependent

Please give me same idea how to correct import holoeverywhere

解决方案

I agree with @7wonders , but importing mine project to HoloEverywhere would make bigger problem than importing HoloEverywhere in it.

After cloning HoloEverywhere, inside of project you have folder named "library". Firstly, I copied it to mine folder "libraries" in project's root and renamed it to "HoloEverywhere".

Secondly, I've edited "build.gradle" file in HoloEverywhere folder like this:

     apply plugin: 'android-library'

  android {
    compileSdkVersion 19
    buildToolsVersion '19.0.0'

  defaultConfig {
     minSdkVersion 7
  }

  sourceSets {

    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        res.srcDirs = ['res']
    }

}
}


dependencies {
   compile files('libs/support-v4-18.0.4.jar')
   compile files('libs/nineoldandroids-2.4.0.jar')
 }

Thirdly, added to "settings.gradle" in project`s root folder

   include ":libraries:HoloEverywhere"

before line with include of your project.

After all we should add library HoloEveryWhere to our main project dependencies in "build.gradle" file inside YourProjectName folder.

    dependencies {             
             compile project(':libraries:HoloEverywhere')
    }

Don't forget to remove from project dependencies support-v4 & support-v7 libraries.

Finally don't forget to clean project. Choose from Android Studio's Menu Build>Clean Project. I recommend to do it via Terminal, because you can't see all errors in Run window. so choose Tools>Open Terminal firstly you should navigate to project root(command "cd ..") and call:

UNIX: ./gradlew clean

Windows: gradlew.bat clean

After successful cleaning build your project.

While build I've got error that there is no "application" tag in AndroidManifest.xml in HoloEverywhere library. So just add it and now everything is OK.

One small, maybe the worst, thing left to do: read basic migration and change all imports, resources(layouts) and override methods with classes from HoloEverywhere library to ignore ClassCastException.

ENJOY :)

这篇关于将 Holoeverywhere 添加到 Android Studio 中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆