Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Can't read [...] (No such file or directory). How to remove extra quotes (""). #731

Closed
zhenkhokh opened this issue Jun 15, 2016 · 3 comments

Comments

@zhenkhokh
Copy link

zhenkhokh commented Jun 15, 2016

Simple project gets from Android Studio 2.0: File -> New -> New Project -> SDK 22 -> Choose template project : Google maps activity.

My pom is

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.eduonix</groupId>
  <artifactId>TestAndroid</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>apk</packaging>

  <name>TestAndroid</name>

     <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <!-- 4.1.1.4 or 5.1.1_r2 or 6.0_r3-->
        <platform.version>6.0_r3</platform.version>
         <!--3.9.0-rc.1 or 4.4.2-->
        <android.plugin.version>4.4.2</android.plugin.version>
<!--com.jayway.maven.plugins.android.generation2 or 
com.simpligility.maven.plugins-->   
<android.plugin.groupId>com.simpligility.maven.plugins</android.plugin.groupId>
        <robolectric.version>3.1-SNAPSHOT</robolectric.version>
         <android.extractDuplicates>true</android.extractDuplicates>
    </properties>
    <repositories>
        <repository>
        <id>local1</id>
        <url>file:/home/zheka/.m2/repository</url>
        <name>local</name>
    </repository>
        <repository>
            <id>android-local</id>
            <url>file:/home/zheka/Android/Sdk/extras/android/m2repository</url>
        </repository>
        <repository>
            <id>android</id>
            <name>Android ROME Feed Reader Repository</name>
            <url>https://android-rome-feed-reader.googlecode.com/svn/maven2/releases</url>
        </repository>
        <repository>
            <id>google-local</id>
            <url>file:/home/zheka/Android/Sdk/extras/google/m2repository</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <name>OSS</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <layout>default</layout>
        </repository>
    </repositories>    
<dependencies>  
      <dependency>
          <!--or com.google.android for less than 5.x.x-->
        <groupId>android</groupId>
        <artifactId>android</artifactId>
        <version>${platform.version}</version>
        <scope>provided</scope>
      </dependency>
    <dependency>
        <groupId>com.squareup</groupId>
        <artifactId>fest-android</artifactId>
        <version>1.0.0</version>
    </dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>
    <dependency>
        <groupId>com.almende.eve</groupId>
        <artifactId>eve-bundle-android-ws</artifactId>
        <version>3.1.1</version>
    </dependency>
    <!-- aar dependencies from android-sdk repositiry -->
    <dependency>
        <!--com.google.android.gms or com.google.android.my-->
        <groupId>com.google.android.gms</groupId>
        <artifactId>play-services</artifactId>
        <!--5.0.89 or 6.5.87-->
        <version>6.5.87</version>
        <type>aar</type>
    </dependency>
        <dependency>
                <groupId>com.google.android.gms</groupId>
                <artifactId>play-service-maps-lib</artifactId>
                <version>1.2</version>
                <!--useing provided escapes dex error -->
                <scope>provided</scope>
        </dependency>
    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>21.0.0</version>
        <type>aar</type>
        <scope>compile</scope>
    </dependency>
    <!--transivyive dependency cant be found-->
<!--dependency>
        <groupId>com.android.support</groupId>
        <artifactId>support-v4</artifactId>
        <version>21.0.0</version>
        <type>jar</type>
        <scope>compile</scope>
</dependency-->
</dependencies>
    <build>
     <finalName>${project.artifactId}</finalName>
            <plugins>
                <plugin>
                    <!--groupId>com.jayway.maven.plugins.android.generation2 or 
com.simpligility.maven.plugins</groupId-->
                    <groupId>${android.plugin.groupId}</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>${android.plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <sdk>
                            <platform>22</platform>
                            <path>/home/zheka/Android/Sdk</path>
                        </sdk>
                        <deleteConflictingFiles>true</deleteConflictingFiles>
                        <undeployBeforeDeploy>true</undeployBeforeDeploy>
            <dex>
                        <jvmArguments>
                                <jvmArgument>-Xmx4096M</jvmArgument>
                            </jvmArguments>
                <multiDex>true</multiDex>
            <!--multi-dex>true</multi-dex-->
                        </dex>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <testSource>1.7</testSource>
                        <testTarget>1.7</testTarget>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                <configuration>
                    <argLine>-noverify</argLine>
                </configuration>
            </plugin>
            </plugins>
    </build>
</project>

Bashing gives:
(1)

mvn -version             ~/workspace/GetStartAndroid/gmapExample
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T00:58:10+04:00)
Maven home: /usr/share/maven
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /usr/local/jdk1.8.0_65/jre
Default locale: ru_RU, platform encoding: UTF-8
OS name: "linux", version: "3.10.17", arch: "amd64", family: "unix"

(2)
Then try
mvn package
or
mvn android:dex
as well have

[INFO] --- android-maven-plugin:4.4.2:dex (default-dex) @ TestAndroid ---
[INFO] Error: Can't read [/home/zheka/workspace/GetStartAndroid/gmapExample/target/classes:/home/zheka/.m2/repository/org/easytesting/fest-assert-core/2.0M8/fest-assert-core-2.0M8.jar:/home/zheka/.m2/repository/org/easytesting/fest-util/1.2.3/fest-util-1.2.3.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cas_appcompat-v7_21.0.0/classes.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cgag_play-services_6.5.87/classes.jar:/home/zheka/.m2/repository/com/almende/eve/eve-bundle-android-ws/3.1.1/eve-bundle-android-ws-3.1.1.jar:/home/zheka/.m2/repository/com/android/support/support-annotations/21.0.0/support-annotations-21.0.0.jar:/home/zheka/.m2/repository/com/squareup/fest-android/1.0.0/fest-android-1.0.0.jar:/home/zheka/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/zheka/.m2/repository/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar:/home/zheka/.m2/repository/junit/junit/4.11/junit-4.11.jar] (No such file or directory)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.483 s
[INFO] Finished at: 2016-06-08T15:49:18+04:00
[INFO] Final Memory: 29M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.4.2:dex (default-dex) on project TestAndroid: Failed to execute mainDexClasses: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd '/home/zheka/workspace/GetStartAndroid/gmapExample' && '/home/zheka/Android/Sdk/build-tools/23.0.3/mainDexClasses' '--output' '/home/zheka/workspace/GetStartAndroid/gmapExample/target/mainDexClasses.txt' '"/home/zheka/workspace/GetStartAndroid/gmapExample/target/classes:/home/zheka/.m2/repository/org/easytesting/fest-assert-core/2.0M8/fest-assert-core-2.0M8.jar:/home/zheka/.m2/repository/org/easytesting/fest-util/1.2.3/fest-util-1.2.3.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cas_appcompat-v7_21.0.0/classes.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cgag_play-services_6.5.87/classes.jar:/home/zheka/.m2/repository/com/almende/eve/eve-bundle-android-ws/3.1.1/eve-bundle-android-ws-3.1.1.jar:/home/zheka/.m2/repository/com/android/support/support-annotations/21.0.0/support-annotations-21.0.0.jar:/home/zheka/.m2/repository/com/squareup/fest-android/1.0.0/fest-android-1.0.0.jar:/home/zheka/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/zheka/.m2/repository/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar:/home/zheka/.m2/repository/junit/junit/4.11/junit-4.11.jar"'

Thats error tolds that dex goal do the /bin/sh -c ... command with error. Realising that some parameters enter with extra quotes ("") then try remove it manually
(3)

/bin/sh -c cd '/home/zheka/workspace/GetStartAndroid/gmapExample' && '/home/zheka/Android/Sdk/build-tools/23.0.3/mainDexClasses' '--output' '/home/zheka/workspace/GetStartAndroid/gmapExample/target/mainDexClasses.txt' '**....**'

where .... is
/home/zheka/workspace/GetStartAndroid/gmapExample/target/classes:/home/zheka/.m2/repository/org/easytesting/fest-assert-core/2.0M8/fest-assert-core-2.0M8.jar:/home/zheka/.m2/repository/org/easytesting/fest-util/1.2.3/fest-util-1.2.3.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cas_appcompat-v7_21.0.0/classes.jar:/home/zheka/workspace/GetStartAndroid/gmapExample/target/unpacked-libs/cgag_play-services_6.5.87/classes.jar:/home/zheka/.m2/repository/com/almende/eve/eve-bundle-android-ws/3.1.1/eve-bundle-android-ws-3.1.1.jar:/home/zheka/.m2/repository/com/android/support/support-annotations/21.0.0/support-annotations-21.0.0.jar:/home/zheka/.m2/repository/com/squareup/fest-android/1.0.0/fest-android-1.0.0.jar:/home/zheka/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/zheka/.m2/repository/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar:/home/zheka/.m2/repository/junit/junit/4.11/junit-4.11.jar

The last one is passes with some warnings. I compared with other group com.jayway.maven.plugins.android.generation2 , 3.9.0-rc.1 version with commenting multiDex option

<multiDex>true</multiDex> option in dex section, again that is in commented pom line 
<!--3.9.0-rc.1 or 4.4.2-->
        <android.plugin.version>4.4.2</android.plugin.version>
<!--com.jayway.maven.plugins.android.generation2 or 
com.simpligility.maven.plugins-->       
<android.plugin.groupId>com.simpligility.maven.plugins</android.plugin.groupId>

....

<!--multiDex>true</multiDex-->

and previous command changing like that

/bin/sh -c cd /home/zheka/workspace/GetStartAndroid/gmapExample && /usr/local/jdk1.8.0_65/jre/bin/java -Xmx4096M -jar /home/zheka/Android/Sdk/build-tools/24.0.0-preview/lib/dx.jar --dex --output= **...**

The last one command is work fine because no extra quotes is generated, but multi-dex (not multiDex) option for this group couldn't be found.

In other forums issue meets for MacOS not for Linux.

@zhenkhokh
Copy link
Author

Solve the issue:
in src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java
line
sb.append( '"' ).append( StringUtils.join( inputFiles, File.pathSeparatorChar ) ).append( '"' );
replace on
sb.append( StringUtils.join( inputFiles, File.pathSeparatorChar ) );

mosabua added a commit that referenced this issue Jun 25, 2016
@mosabua
Copy link
Member

mosabua commented Jun 25, 2016

Committed with 24499f2

@mosabua
Copy link
Member

mosabua commented Jun 25, 2016

Will be released with 4.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants