Domanda

I'm trying to migrate an application developed in Eclipse to Intellij Idea, the application uses ActionBarSherlock and Android-MenuDrawer (SimonVT)

I am having a problem importing the Android-MenuDrawer library using Maven. With ActionBarSherlock compiles fine and I can use it well in a project, but not with MenuDrawer.

When I try to compile with Maven gives me the following error:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[854,40] cannot find symbol
  symbol:   variable LAYOUT_DIRECTION_RTL
  location: class net.simonvt.menudrawer.MenuDrawer
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[861,40] cannot find symbol
  symbol:   variable LAYOUT_DIRECTION_RTL
  location: class net.simonvt.menudrawer.MenuDrawer
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[873,14] cannot find symbol
  symbol: method onRtlPropertiesChanged(int)
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[882,80] cannot find symbol
  symbol:   variable LAYOUT_DIRECTION_RTL
  location: class net.simonvt.menudrawer.MenuDrawer
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[871,5] method does not override or implement a method from a supertype
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java:[1325,72] cannot find symbol
  symbol:   variable LAYOUT_DIRECTION_RTL
  location: class net.simonvt.menudrawer.MenuDrawer
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/ViewHelper.java:[44,57] cannot find symbol
  symbol:   variable JELLY_BEAN_MR1
  location: class android.os.Build.VERSION_CODES
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/ViewHelper.java:[45,21] cannot find symbol
  symbol:   method getLayoutDirection()
  location: variable v of type android.view.View
[ERROR] /D:/Android/menudrawer/menudrawer/src/net/simonvt/menudrawer/ViewHelper.java:[48,20] cannot find symbol
  symbol:   variable LAYOUT_DIRECTION_LTR
  location: class android.view.View
È stato utile?

Soluzione

I could find the error . The problem is the dependence of the android sdk , the actal is 4.1.1.4 (api 16) is the last in the maven repository . But the project needs the api 17+

Follow these steps : 1) Download a version of sdk 17+ 2) Download the maven-android-sdk-deployer project, and read the instructions for installation 3) Edit the pom.xml file ( the root ) by changing the property 4.1.1.4 and 16 by any of the following , depending on the SDK :

<android.version>4.2.2_r2</android.version>
<android.platform>17</android.platform>

<android.version>4.3_r2</android.version>
<android.platform>18</android.platform>

<android.version>4.4_r1</android.version>
<android.platform>19</android.platform>

and also edit

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android</artifactId>
    <version>${android.version}</version>
</dependency>

by

<dependency>
    <groupId>android</groupId>
    <artifactId>android</artifactId>
    <version>${android.version}</version>
</dependency>

It is also necessary to update the version of maven plugin 3.6.0 to 3.8.0.

Change this:

<plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    <version>3.6.0</version>
    <configuration>
        <sdk>
            <platform>${android.platform}</platform>
        </sdk>
    </configuration>
    <extensions>true</extensions>
</plugin>

by this:

<plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <sdk>
            <platform>${android.platform}</platform>
        </sdk>
    </configuration>
    <extensions>true</extensions>
</plugin>

4) Edit the pom.xml ( the menudrawer folder) edit the following :

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android</artifactId>
    <scope>provided</scope>
</dependency>

by

<dependency>
    <groupId>android</groupId>
    <artifactId>android</artifactId>
    <scope>provided</scope>
</dependency>

recharge the maven project and compile

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top