Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24166] Unable to adding support-compat-24.2.0.jar to Android Module

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2017-11-13T17:59:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterShuo Liang
AssigneeGary Mathews
Created2016-11-23T01:46:18.000+0000
Updated2017-11-13T17:59:04.000+0000

Description

Problem

Custom facing problem: "I'm trying to import android.support.v4.app.NotificationCompat class in my Appcelerator Android Module project. To do this I have added jar 'support-compat-24.2.0.jar' in the lib folder. This has resolved all the import errors in the module."

Reproduce

1. Attached test Module customer created. 2. Simply import and require it into a default app. Like:
var testmodule = require('com.abc.mcoe.testmodule');
3. Run the app. Will get following error.

Error

[ERROR] :  Failed to run dexer:
[ERROR] :  
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportSubMenu;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportMenu;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportMenuItem;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationManagerCompat;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Style;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$NotificationCompatImplJellybean;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ShareCompat$ShareCompatImplJB;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Action$1;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Builder;
[ERROR] :  
[ERROR] :  UNEXPECTED TOP-LEVEL EXCEPTION:
[ERROR] :  java.lang.RuntimeException: Translation has been interrupted
[ERROR] :  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
[ERROR] :  	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
[ERROR] :  	at com.android.dx.command.dexer.Main.run(Main.java:277)
[ERROR] :  	at com.android.dx.command.dexer.Main.main(Main.java:245)
[ERROR] :  	at com.android.dx.command.Main.main(Main.java:106)
[ERROR] :  Caused by: java.lang.InterruptedException: Too many errors
[ERROR] :  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
[ERROR] :  	... 4 more

Attachments

FileDateSize
testmodule.zip2016-11-23T01:45:55.000+00002668312

Comments

  1. Gary Mathews 2016-11-23

    [~sliang] Upgrade to 6.0.0, remove support-compat-24.2.0.jar from your libs folder and run appc run -p android --build-only in the android directory of your module project. android-support-v4.jar should already be included for android.support.v4.app.NotificationCompat Let me know if that solves the issue.
  2. Gary Mathews 2017-01-10

    I compiled the testmodule using 6.0.1.GA without the included 'support-compat-24.2.0.jar' and imported it into a test project (also compiled with 6.0.1.GA).
       var testmodule = require('com.abc.mcoe.testmodule');
       Ti.API.info('testmodule: ' + testmodule);
       
       I/TiAPI:  testmodule: [object Object]
       
    The app runs fine and does not crash.
  3. Neeraj Mishra 2017-03-01

    [~gmathews]: The problem here is if in the module we import the below statement (customer wants to use the library in module) and to resolve the reference we would have to add the 'support-compat-24.2.0.jar' in /android/lib directory in module. Module packaging works perfectly fine. Now we import the module in app test project with same code you ran above, then building the app project would throw the error messages as below.

    Import statement in module:

    import android.support.v4.app.NotificationCompat;

    Error messages

       Packaging application: /Users/nmishra/Library/android-sdk-macosx/build-tools/23.0.1/aapt "package" "-f" "-m" "-J" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/gen" "-M" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/AndroidManifest.xml" "-A" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/bin/assets" "-S" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/res" "-I" "/Users/nmishra/Library/android-sdk-macosx/platforms/android-23/android.jar" "-F" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/bin/app.ap_" "--auto-add-overlay" "--extra-packages" "ti.modules.titanium.ui:android.support.v7.appcompat:android.support.v7.cardview" "-S" "/var/folders/2m/ln867lq52w15tlw7tpkw6nv0_kfn0r/T/117128-18997-13aet6j/res" "-S" "/var/folders/2m/ln867lq52w15tlw7tpkw6nv0_kfn0r/T/117128-18997-1lumtg4/res" "-S" "/var/folders/2m/ln867lq52w15tlw7tpkw6nv0_kfn0r/T/117128-18997-x5vx3m/res"
       [INFO] :   Building Java source files: /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/javac "-J-Xmx1024M" "-encoding" "utf8" "-bootclasspath" "/Users/nmishra/Library/android-sdk-macosx/platforms/android-23/android.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/kroll-v8.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-analytics.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/aps-analytics.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-android.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/jaxen-1.1.1.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/ti-commons-codec-1.3.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/kroll-common.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/titanium.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-multidex.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-filesystem.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-app.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-ui.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/nineoldandroids-appc-2.4.0.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-media.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-appcompat.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-v4.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-v7-appcompat.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-cardview.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/cardview-v7-23.0.1.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-locale.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-network.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-xml.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-utils.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-geolocation.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-accelerometer.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-contacts.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-map.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-calendar.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-gesture.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-platform.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-database.jar:/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/modules/android/com.abc.mcoe.testmodule/1.0.0/testmodule.jar:/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/modules/android/com.abc.mcoe.testmodule/1.0.0/lib/support-compat-24.2.0.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/kroll-apt.jar:/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/lib/titanium-verify.jar:R.class:Abc_jar_issueActivity.class:Abc_jar_issueAppInfo.class:Abc_jar_issueApplication.class:AssetCryptImpl.class" "-d" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/bin/classes" "-proc:none" "-target" "1.6" "-source" "1.6" "@/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/java-sources.txt"
       [INFO] :   Running dexer: /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java "-Xmx1024M" "-XX:-UseGCOverheadLimit" "-Djava.ext.dirs=/Users/nmishra/Library/android-sdk-macosx/platform-tools" "-jar" "/Users/nmishra/Library/android-sdk-macosx/build-tools/23.0.1/lib/dx.jar" "--dex" "--multi-dex" "--output=/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/bin/dexfiles" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/build/android/bin/classes" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/lib/titanium-verify.jar" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/modules/android/com.abc.mcoe.testmodule/1.0.0/testmodule.jar" "/Users/nmishra/Documents/Appcelerator_Studio_Workspace/ABC_jar_issue/modules/android/com.abc.mcoe.testmodule/1.0.0/lib/support-compat-24.2.0.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/kroll-v8.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-analytics.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/aps-analytics.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-android.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/jaxen-1.1.1.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/ti-commons-codec-1.3.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/kroll-common.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/titanium.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-multidex.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-filesystem.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-app.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-ui.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/nineoldandroids-appc-2.4.0.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-media.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-appcompat.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-v4.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/android-support-v7-appcompat.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-cardview.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/cardview-v7-23.0.1.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-locale.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-network.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-xml.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-utils.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-geolocation.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-accelerometer.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-contacts.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-map.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-calendar.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-gesture.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-platform.jar" "/Users/nmishra/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android/modules/titanium-database.jar"
       [ERROR] :  Failed to run dexer:
       [ERROR] :  
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportSubMenu;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportMenu;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/internal/view/SupportMenuItem;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationManagerCompat;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Style;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$NotificationCompatImplJellybean;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ShareCompat$ShareCompatImplJB;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Action$1;
       [ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/NotificationCompat$Builder;
       [ERROR] :  
       [ERROR] :  UNEXPECTED TOP-LEVEL EXCEPTION:
       [ERROR] :  java.lang.RuntimeException: Translation has been interrupted
       [ERROR] :  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
       [ERROR] :  	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
       [ERROR] :  	at com.android.dx.command.dexer.Main.run(Main.java:275)
       [ERROR] :  	at com.android.dx.command.dexer.Main.main(Main.java:245)
       [ERROR] :  	at com.android.dx.command.Main.main(Main.java:106)
       [ERROR] :  Caused by: java.lang.InterruptedException: Too many errors
       [ERROR] :  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
       [ERROR] :  	... 4 more
       
  4. Jan Vennemann 2017-03-02

    [~nmishra], as Gary already pointed out, you do not need to explicitly add the Android Support Library to the module to use it. I tested it with both CLI and Studio and the build works just fine with import android.support.v4.app.NotificationCompat;. To remove the warning in Appcelerator Studio that the import cannot be resolved you can do the following: 1. Right-click the module project (root folder) and select *Properties* to open the project's properties dialog. 2. In the left pane, select *Java Build Path*. 3. In the right pane, click the *Libraries* tab. 4. Click the *Add External JARs...* button to open the JAR Selection dialog. 5. Navigate to ~/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android folder and select the android-support-v4 JAR. 6. Click Open. The JAR should be added to the JARs list. 7. Click OK to dismiss the dialog. If the issue still persists, please provide detailed steps to reproduce it.
  5. Neeraj Mishra 2017-03-02

    [~jvennemann] : Thanks much. It really worked like charm. We just could not find what was the conflicting jar from sdk.

JSON Source