Add Holoeverywhere to project in Android Studio

冷暖自知 提交于 2019-12-01 08:35:45

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 :)

To get it working on the most basic of levels just follow the advice given here:

https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE

Basically close all projects so you get to the welcome screen. Then:

-> Checkout from Version Control - Git -> Type in Repository URL: https://github.com/Prototik/HoloEverywhere.git -> Press 'Clone', wait until repository checkout -> click 'Yes' on the proposal to open a project.

This should give you a HoloEverywhere project thats ready to work with.

Open up File > Project structure and check for any errors with missing libraries (for example I had to download manually the v4 r18 file).

Click apply > ok to make sure changes are saved and return to the project. Click on demo and then click Run > Edit configurations. Click + then Android Application. Call it demo or whatever. Select demo as module, launch default activity checked, deploy checked, USB device checked.

Hitting the little debug dude should now get you running the demo. From here its simply a case of refactoring the demo to your own project or creating a new Android Application module within the HoloEverywhere project.

In other words, instead of trying to add HoloEverywhere to your project, add your project to HoloEverywhere :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!