Add Holoeverywhere to project in Android Studio

后端 未结 2 1212
无人共我
无人共我 2021-01-14 20:57

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 m

相关标签:
2条回答
  • 2021-01-14 21:18

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

    0 讨论(0)
  • 2021-01-14 21:27

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

    0 讨论(0)
提交回复
热议问题