pitate7777777 / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

assets and res folder contents should not be copied in apklib src folder #425

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a class android maven project
2. mvn package
3. unzip -m <path to my apklib>

What is the expected output?
|src
|- com
|res
|- values
|- ...
|assets
|- <my assets>
|AndroidManifest.xml

What do you see instead?
|src
|- com
|- <my assets>
|- values
|- ..
|res
|- values
|- ...
|assets
|- <my assets>
|AndroidManifest.xml

What version of maven-android-plugin are you using?
3.6.1

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /usr/local/apache-maven/apache-maven-3.0.3
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: fr_FR, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Please provide any additional information below.

It seems to me that the bug come from : 

com.jayway.maven.plugins.android.phase09package.ApklibMojo
  protected File createApkLibraryFile() throws MojoExecutionException
    {
        final File apklibrary = new File( project.getBuild().getDirectory(),
                project.getBuild().getFinalName() + "." + APKLIB );
        FileUtils.deleteQuietly( apklibrary );

        try
        {
            JarArchiver jarArchiver = new JarArchiver();
            jarArchiver.setDestFile( apklibrary );

            jarArchiver.addFile( androidManifestFile, "AndroidManifest.xml" );
            addDirectory( jarArchiver, assetsDirectory, "assets" );
            addDirectory( jarArchiver, resourceDirectory, "res" );
            [...]

It seems to me that assets and res content should not be added to APKLIB ?

Original issue reported on code.google.com by lun...@gmail.com on 29 Oct 2013 at 5:11

GoogleCodeExporter commented 9 years ago
Test against 3.8.3-SNAPSHOT

If the failure stills occurs then provide a project or link to a project that 
clearly highlights the failure.

Original comment by william....@xandar.com.au on 17 Feb 2014 at 11:15

GoogleCodeExporter commented 9 years ago
I still have the issue : 
/usr/local/apache-maven/apache-maven-3.1.1/bin/mvn clean  install 
-DskipTests=true
unzip -l /Users/glung/.m2/repository/mylibrairy.apklib

[...]
      799  02-26-14 17:19   res/layout/mma_tab_indicator.xml
     1950  02-26-14 17:19   res/layout/row_listview_tyre.xml
     1665  02-26-14 17:19   res/layout/row_listview_tyre_no_vehicle.xml
     1016  02-26-14 17:19   res/layout/row_listview_tyres_footer.xml
     2389  02-26-14 17:19   res/layout/row_listview_vehicle.xml
     1005  02-26-14 17:19   res/layout/row_listview_vehicle_footer.xml
     3330  02-26-14 17:19   res/layout/row_my_review.xml
    10957  02-26-14 17:19   res/layout/vehicle_form.xml
      318  02-26-14 17:19   res/menu/validate_menu.xml
      366  02-26-14 17:19   res/menu/welcome_activity_menu.xml
     8459  02-26-14 17:19   res/values/arrays.xml
[...]
     1016  01-03-14 11:49   src/layout/row_listview_tyres_footer.xml
     2389  01-03-14 11:49   src/layout/row_listview_vehicle.xml
     1005  01-03-14 11:49   src/layout/row_listview_vehicle_footer.xml
     3330  01-03-14 11:49   src/layout/row_my_review.xml
    10957  01-03-14 11:49   src/layout/vehicle_form.xml
      318  02-24-14 14:48   src/menu/validate_menu.xml
      366  02-24-14 14:48   src/menu/welcome_activity_menu.xml
     8459  01-14-14 16:13   src/values/arrays.xml
      234  01-14-14 16:13   src/values/attrs.xml
     1688  01-14-14 16:13   src/values/colors.xml
      540  01-14-14 16:13   src/values/dimens.xml
    11289  02-24-14 14:48   src/values/strings.xml
     6636  02-24-14 14:48   src/values/styles.xml
    12090  02-24-14 14:48   src/values-de/strings.xml
    11722  02-24-14 14:48   src/values-es/strings.xml
    11607  02-24-14 14:48   src/values-fr/strings.xml
    11624  02-24-14 14:48   src/values-it/strings.xml
      311  01-03-14 11:49   src/values-large/styles.xml
      696  01-03-14 11:49   src/values-v11/styles.xml
     1171  01-03-14 11:49   src/values-v11/themes.xml
      952  01-03-14 11:49   src/values-v14/themes.xml

Original comment by lun...@gmail.com on 26 Feb 2014 at 4:12

GoogleCodeExporter commented 9 years ago
I can't distribute the project. I'll try to build a new one. 

Sorry for the late answer and thank you for the support.

Original comment by lun...@gmail.com on 26 Feb 2014 at 4:16

GoogleCodeExporter commented 9 years ago
Great, create as small a project as you can (that you can distribute) and post 
a link to it or post the project.

Original comment by william....@xandar.com.au on 26 Feb 2014 at 9:53

GoogleCodeExporter commented 9 years ago
Lungos, any chance of that cut down project any time soon?

Original comment by william....@xandar.com.au on 10 Mar 2014 at 11:56

GoogleCodeExporter commented 9 years ago
William, 

Sorry for the late answer. I've been digging into the problem and I'm not sure 
of the issue anymore. I think you have to qualify it. 

In this project, I use the maven filtering feature. I filter the resources to 
activate/desactive features, changes colors, text resources, ... depending on a 
filter which is loaded depending on the profile activated (staging, production, 
... ). 

Thus, my project looks alike : 
|src
|- main
|-- java
|--- <source code>
|-- filters
|---  stagging.properties
|--- production.properties
|-- resources
|--- assets
|---- <my assets>
|--- res
|---- drawable
|---- [...]
|---- values
|res <- Resources from src/main/resources filterd with a filter from 
/src/main/filters
|- drawable
|- [...]
|- values
|assets
|- <my assets>
|AndroidManifest.xml

Maybe I'm doing wrong ... and maven exports resources in classpath (src).. 
It make sense to me and I have an horrible doubt about this issue.

If tis is not an issue , how to you filter resources on android projects ?

Original comment by lun...@gmail.com on 11 Mar 2014 at 10:04

GoogleCodeExporter commented 9 years ago
I don't filter resources on Android projects. I stopped doing so about 2.5 
years ago because I couldn't see any value in it. I always create a production 
apk, everytime.

I'm having trouble understanding what the problem is.
Are you able to create a cut down project that shows the error?

Original comment by william....@xandar.com.au on 11 Mar 2014 at 11:33

GoogleCodeExporter commented 9 years ago
I'll send the project tomorrow. 

Original comment by lun...@gmail.com on 11 Mar 2014 at 8:33

GoogleCodeExporter commented 9 years ago
Sorry for being late.

Once again, I don't think anymore it is an issue. Maven copies resources to the 
classpath. Make sense to me.

Original comment by lun...@gmail.com on 17 Mar 2014 at 3:55

Attachments:

GoogleCodeExporter commented 9 years ago
OK, now that I can see what you are attempting to do I can verify that this is 
not an issue.

Android resources are totally different from Java resources.
The maven-resources-plugin applies filters to Java resources.
When it does so it also adds those resources to the classpath.

You are better off using the resourceOverlayDirectory param for the 
android-maven-plugin to specify the location of any resources that you want 
applied over the top of the main resources. And then use a production and 
staging maven profile to determine its value.

Original comment by william....@xandar.com.au on 18 Mar 2014 at 7:46