IntelliJ and android.support.v7.widget.GridLayout

后端 未结 3 1920
傲寒
傲寒 2020-12-07 03:18

I am running into trouble either setting up the support v7 GridLayout library in my IntelliJ project, or properly referencing it in my code.

I currently use the Acti

3条回答
  •  Happy的楠姐
    2020-12-07 03:45

    Ok, I figured this out. Turns out it was a configuration issue. Here is what I did to set up the support GridLayout library, as well as reference the classes in code.

    • Copy [android-sdk-folder]/extras/android/support/v7/gridlayout folder to your project libs folder

    Set up support GridLayout library in IntelliJ:

    • Project Structure -> Modules in Project Settings pane -> New Module
    • Create module from scratch -> Next
    • Name the project, browse to your libs/gridlayout folder and choose as Content Root, leave the Module Root set by the Content Root assignment, and select Android Module type -> Next
    • Do not create source directory -> Next
    • Do not create Android application structure -> Finish
    • Select Facets in Project Settings pane -> Select your new module -> Check 'Is Library Project'

    Add dependancy to project in IntelliJ:

    • Select Modules in Project Settings pane -> Select the project in which you wish to use the support GridLayout
    • Select Dependancies tab -> click [+] to add new Module Dependancy
    • Select your support library from previous section

    You also need to add a reference to the support v7 GridLayout jar file in the support project libs dir.

    • Still on Dependancies tab -> click [+] to add new Library -> Java
    • Browse to the libs/gridlayout/libs folder and select the support v7 GridLayout .jar
    • Select level (I only needed Project level) -> OK

    Hopefully this helps someone else - I wasted most my day on it. =|

提交回复
热议问题