Top

Build Release Error in Android SDK

Commentaires

11 commentaires

  • Commentaire officiel
    Jérôme Gully

    Hi,

    Short answer : Add this line in your app proguard file.

    -keep class org.json.** { *;}

    Long answer:

    proguard obfuscated the JSONObject class (and other classes from org.json), so the OS try to retrieve the library from another location (other implemented libraries in your project or a default one in the OS). And the default library don't have same code (JSON.toString() don't have the else part). In debug builds proguard is generally disabled so the problem don't occur.

    Actions pour les commentaires Permalien
  • Jérôme Gully

    Hello,

     

    Can you paste here the error logs ?

    0
    Actions pour les commentaires Permalien
  • Muhammad Syahroyni

    Hai @Jerome

    This is the logs 

    05 MAR 2019 16:22:28,214 INFO [main] RainbowSdk - >>>> Rainbow Application start <<<<
    05 MAR 2019 16:22:28,626 INFO [main] Connection - >start Rainbow SDK
    05 MAR 2019 16:22:28,647 INFO [main] RainbowService - onCreate
    05 MAR 2019 16:22:28,649 INFO [main] RainbowSdk - initialize
    05 MAR 2019 16:22:28,660 INFO [main] GsmPhone - >connectToTelephonyService
    05 MAR 2019 16:22:28,669 WARN [main] GsmPhone - connectToTelephonyService java.lang.ClassCastException: com.android.internal.telephony.ITelephony$Stub$Proxy cannot be cast to com.b.a.a.a
    05 MAR 2019 16:22:28,673 INFO [main] RainbowSdk - initialize services
    05 MAR 2019 16:22:28,675 INFO [main] RainbowContext - Rainbow state = INITIALIZING
    05 MAR 2019 16:22:28,675 INFO [main] RainbowService - initializeInfra
    05 MAR 2019 16:22:28,677 INFO [main] Infrastructure - Create infrastructure
    05 MAR 2019 16:22:28,677 INFO [main] Infrastructure - Run event handler
    05 MAR 2019 16:22:28,679 DEBUG [main] DataNetworkMonitor - computeDataNetworkAvailability
    05 MAR 2019 16:22:28,680 INFO [main] DataNetworkMonitor - New data connection state : DATA_CONNECTED
    05 MAR 2019 16:22:28,680 INFO [main] DataNetworkMonitor - data connection type changed to 3G or wifi
    05 MAR 2019 16:22:28,704 INFO [main] ProfileProxy - initialization
    05 MAR 2019 16:22:28,728 INFO [main] AvatarProxy - initialization
    05 MAR 2019 16:22:28,729 INFO [main] DirectoryProxy - initialization
    05 MAR 2019 16:22:28,729 INFO [main] UsersProxy - initialization
    05 MAR 2019 16:22:28,730 INFO [main] EnduserBotsProxy - initialization
    05 MAR 2019 16:22:28,730 INFO [main] CompanyProxy - initialization
    05 MAR 2019 16:22:28,730 INFO [main] CalendarProxy - initialization
    05 MAR 2019 16:22:28,730 INFO [main] Office365Proxy - initialization
    05 MAR 2019 16:22:28,734 INFO [main] BitmapCache - Create photo cache of size : 24576 kB
    05 MAR 2019 16:22:28,734 INFO [main] RoomProxy - initialization
    05 MAR 2019 16:22:28,734 INFO [main] AuthenticationProxy - initialization
    05 MAR 2019 16:22:28,735 INFO [main] ConversationProxy - initialization
    05 MAR 2019 16:22:28,735 INFO [main] NotificationsProxy - initialization
    05 MAR 2019 16:22:28,735 INFO [main] ApkProvisionnerProxy - initialization
    05 MAR 2019 16:22:28,736 INFO [main] GroupProxy - initialization
    05 MAR 2019 16:22:28,736 INFO [main] FileProxy - initialization
    05 MAR 2019 16:22:28,737 INFO [main] PgiConferenceProxy - initialization
    05 MAR 2019 16:22:28,737 INFO [main] ChannelProxy - initialization
    05 MAR 2019 16:22:28,739 INFO [main] PBXTelephonyProxy - initialization
    05 MAR 2019 16:22:28,742 INFO [main] MetricsProxy - initialization
    05 MAR 2019 16:22:28,746 DEBUG [main] RainbowService - onBind
    05 MAR 2019 16:22:28,746 INFO [connectThread] ContactDataSource - getAllContacts BEG
    05 MAR 2019 16:22:28,749 INFO [connectThread] ContactDataSource - getAllContacts END: 0
    05 MAR 2019 16:22:28,752 INFO [main] DataNetworkMonitor - onReceive intent CONNECTIVITY_ACTION
    05 MAR 2019 16:22:29,254 DEBUG [main] DataNetworkMonitor - computeDataNetworkAvailability
    05 MAR 2019 16:22:40,368 INFO [main] Connection - > signin with login 'cgc.367@cgc.client' (host: openrainbow.com)
    05 MAR 2019 16:22:40,374 INFO [Thread-19] ApplicationData - Save token
    05 MAR 2019 16:22:40,376 INFO [Thread-19] ApplicationData - Save login : cgc.367@cgc.client
    05 MAR 2019 16:22:40,382 INFO [Thread-19] RainbowSdk - RainbowSdk is initialized
    05 MAR 2019 16:22:40,382 INFO [Thread-19] Infrastructure - >startConnectionProcess
    05 MAR 2019 16:22:40,383 INFO [Thread-19] Infrastructure - >connectToRainbowServer
    05 MAR 2019 16:22:40,384 INFO [Thread-19] RESTAsyncRequest - Request size is : 61 for request: https://openrainbow.com/api/rainbow/authentication/v1.0/login
    05 MAR 2019 16:22:41,17 INFO [main] RESTAsyncRequest - Response size is: 3361 for request: https://openrainbow.com/api/rainbow/authentication/v1.0/login
    05 MAR 2019 16:22:41,33 ERROR [pool-1-thread-1] AuthenticationProxy - Impossible to parse REST authentication credentials
    05 MAR 2019 16:22:41,34 WARN [pool-1-thread-1] RainbowServiceException - Exception not managed; JSONObject["guestMode"] not a string.
    05 MAR 2019 16:22:41,35 WARN [pool-1-thread-1] Infrastructure - Authentication Failure

    0
    Actions pour les commentaires Permalien
  • Jérôme Gully

    Thank you for the error log. Can you also give me the reference of your smartphone and the Android version you use please ?

    My understand is that in release mode the JSON library is obfuscated and then maybe an integrated strange JSON library integrated in your phone is used, with specific code that throw this error. With the default JSONObject this can't happend.

    0
    Actions pour les commentaires Permalien
  • Muhammad Syahroyni

    I use Xiaomi Redmi 4x with Android Nougat API Level 25

    0
    Actions pour les commentaires Permalien
  • Muhammad Syahroyni

    The error still occurs,
    And its force close before the sign in listener called by SDK.

    For more information,

    This is error from gradle when I build the release version :

    - Error: json defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]

    - Error: xpp3 defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]

    I try to ignore the error with :

    lintOptions {
    checkReleaseBuilds false
    abortOnError false
    }

    The result always force close before the apps open.

    Then, I exclude the xpp3 and json with :

    implementation ('com.ale:rainbowsdk:1.52.0') {
    exclude group: 'xpp3', module: 'xpp3'
    exclude group:'json', module: 'json'
    }

    The result is the log that I paste above.

    Then, I try to use your answer to keep the json and change the proguard files like your answer and change the gradle to :

    implementation ('com.ale:rainbowsdk:1.52.0') {
    exclude group: 'xpp3', module: 'xpp3'
    }

    The result is its force close before the sign in listener called by SDK.

    And this is the log :

    12 MAR 2019 03:59:16,473 INFO [main] RainbowSdk - >>>> Rainbow Application start <<<<
    12 MAR 2019 03:59:16,784 INFO [main] Connection - >start Rainbow SDK
    12 MAR 2019 03:59:16,796 INFO [main] RainbowService - onCreate
    12 MAR 2019 03:59:16,799 INFO [main] RainbowSdk - initialize
    12 MAR 2019 03:59:16,801 INFO [main] GsmPhone - >connectToTelephonyService
    12 MAR 2019 03:59:16,804 WARN [main] GsmPhone - connectToTelephonyService java.lang.ClassCastException: com.android.internal.telephony.ITelephony$Stub$Proxy cannot be cast to com.b.a.a.a
    12 MAR 2019 03:59:16,805 INFO [main] RainbowSdk - initialize services
    12 MAR 2019 03:59:16,806 INFO [main] RainbowContext - Rainbow state = INITIALIZING
    12 MAR 2019 03:59:16,807 INFO [main] RainbowService - initializeInfra
    12 MAR 2019 03:59:16,808 INFO [main] Infrastructure - Create infrastructure
    12 MAR 2019 03:59:16,808 INFO [main] Infrastructure - Run event handler
    12 MAR 2019 03:59:16,811 DEBUG [main] DataNetworkMonitor - computeDataNetworkAvailability
    12 MAR 2019 03:59:16,812 INFO [main] DataNetworkMonitor - New data connection state : DATA_CONNECTED
    12 MAR 2019 03:59:16,812 INFO [main] DataNetworkMonitor - data connection type changed to 3G or wifi
    12 MAR 2019 03:59:16,819 INFO [main] ProfileProxy - initialization
    12 MAR 2019 03:59:16,826 INFO [main] AvatarProxy - initialization
    12 MAR 2019 03:59:16,827 INFO [main] DirectoryProxy - initialization
    12 MAR 2019 03:59:16,827 INFO [main] UsersProxy - initialization
    12 MAR 2019 03:59:16,827 INFO [main] EnduserBotsProxy - initialization
    12 MAR 2019 03:59:16,828 INFO [main] CompanyProxy - initialization
    12 MAR 2019 03:59:16,828 INFO [main] CalendarProxy - initialization
    12 MAR 2019 03:59:16,828 INFO [main] Office365Proxy - initialization
    12 MAR 2019 03:59:16,831 INFO [main] BitmapCache - Create photo cache of size : 24576 kB
    12 MAR 2019 03:59:16,832 INFO [main] RoomProxy - initialization
    12 MAR 2019 03:59:16,832 INFO [main] AuthenticationProxy - initialization
    12 MAR 2019 03:59:16,832 INFO [main] ConversationProxy - initialization
    12 MAR 2019 03:59:16,833 INFO [main] NotificationsProxy - initialization
    12 MAR 2019 03:59:16,833 INFO [main] ApkProvisionnerProxy - initialization
    12 MAR 2019 03:59:16,833 INFO [main] GroupProxy - initialization
    12 MAR 2019 03:59:16,834 INFO [main] FileProxy - initialization
    12 MAR 2019 03:59:16,834 INFO [main] PgiConferenceProxy - initialization
    12 MAR 2019 03:59:16,834 INFO [main] ChannelProxy - initialization
    12 MAR 2019 03:59:16,836 INFO [main] PBXTelephonyProxy - initialization
    12 MAR 2019 03:59:16,842 INFO [main] MetricsProxy - initialization
    12 MAR 2019 03:59:16,846 DEBUG [main] RainbowService - onBind
    12 MAR 2019 03:59:16,846 INFO [connectThread] ContactDataSource - getAllContacts BEG
    12 MAR 2019 03:59:16,848 INFO [connectThread] ContactDataSource - getAllContacts END: 0
    12 MAR 2019 03:59:16,848 INFO [main] DataNetworkMonitor - onReceive intent CONNECTIVITY_ACTION
    12 MAR 2019 03:59:16,849 INFO [main] DataNetworkMonitor - has wifi
    12 MAR 2019 03:59:17,350 DEBUG [main] DataNetworkMonitor - computeDataNetworkAvailability
    12 MAR 2019 03:59:32,642 INFO [main] Connection - > signin with login 'cgc.367@cgc.client' (host: openrainbow.com)
    12 MAR 2019 03:59:32,642 INFO [main] Connection - resetCacheAndDatabase BEG
    12 MAR 2019 03:59:32,644 INFO [main] DatabaseMgr - Reset database
    12 MAR 2019 03:59:32,716 INFO [main] DatabaseHelper - onCreate database
    12 MAR 2019 03:59:32,793 INFO [main] Connection - resetCacheAndDatabase END
    12 MAR 2019 03:59:32,803 INFO [main] ApplicationData - Server Url : openrainbow.com
    12 MAR 2019 03:59:32,804 DEBUG [main] ApplicationData - Add http scheme to Url
    12 MAR 2019 03:59:32,810 INFO [main] ApplicationData - Server Type : PROD
    12 MAR 2019 03:59:32,819 INFO [Thread-19] Connection - resetCacheAndDatabase BEG
    12 MAR 2019 03:59:32,820 INFO [Thread-19] DatabaseMgr - Reset database
    12 MAR 2019 03:59:32,896 INFO [Thread-19] DatabaseHelper - onCreate database
    12 MAR 2019 03:59:32,986 INFO [Thread-19] Connection - resetCacheAndDatabase END
    12 MAR 2019 03:59:32,987 INFO [Thread-19] ApplicationData - Save token
    12 MAR 2019 03:59:32,988 INFO [Thread-19] ApplicationData - Save login : cgc.367@cgc.client
    12 MAR 2019 03:59:33,05 INFO [Thread-19] RainbowSdk - RainbowSdk is initialized
    12 MAR 2019 03:59:33,06 INFO [Thread-19] Infrastructure - >startConnectionProcess
    12 MAR 2019 03:59:33,06 INFO [Thread-19] Infrastructure - >connectToRainbowServer
    12 MAR 2019 03:59:33,08 INFO [Thread-19] RESTAsyncRequest - Request size is : 61 for request: https://openrainbow.com/api/rainbow/authentication/v1.0/login
    12 MAR 2019 03:59:34,661 INFO [main] RESTAsyncRequest - Response size is: 3361 for request: https://openrainbow.com/api/rainbow/authentication/v1.0/login
    12 MAR 2019 03:59:34,690 INFO [pool-1-thread-1] ApplicationData - Save im jid : d7984134e2c14839a57394be3164bd7d@openrainbow.com
    12 MAR 2019 03:59:34,721 INFO [pool-1-thread-1] Infrastructure - Authentication Success
    12 MAR 2019 03:59:34,729 DEBUG [pool-1-thread-1] c - >refreshJoinCompanyRequestList
    12 MAR 2019 03:59:34,731 INFO [Thread-21] UsersProxy - getReceivedCompanyInvitations URL :https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/join-companies/invitations?format=medium
    12 MAR 2019 03:59:34,733 INFO [Thread-21] RESTAsyncRequest - Request size is : 120 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/join-companies/invitations?format=medium
    12 MAR 2019 03:59:34,737 INFO [pool-1-thread-1] RESTAsyncRequest - Request size is : 97 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/profiles/features
    12 MAR 2019 03:59:34,740 INFO [pool-1-thread-1] RESTAsyncRequest - Request size is : 75 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/users/networks?format=full
    12 MAR 2019 03:59:34,741 INFO [Thread-23] CompanyProxy - >getCompany
    12 MAR 2019 03:59:34,742 INFO [Thread-23] RESTAsyncRequest - Request size is : 95 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/companies/5a9cdbb98719bf0e4665219e?format=full
    12 MAR 2019 03:59:34,742 DEBUG [pool-1-thread-1] Infrastructure - New authentification done for user : cgc.367@cgc.client
    12 MAR 2019 03:59:34,742 INFO [Thread-22] UsersProxy - getJoinCompanyRequests URL :https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/join-companies/requests?format=medium
    12 MAR 2019 03:59:34,743 DEBUG [pool-1-thread-1] Infrastructure - time waited 1296000258
    12 MAR 2019 03:59:34,743 INFO [Thread-22] RESTAsyncRequest - Request size is : 117 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/join-companies/requests?format=medium
    12 MAR 2019 03:59:34,746 INFO [pool-1-thread-1] RESTAsyncRequest - Request size is : 64 for request: https://openrainbow.com/api/rainbow/fileserver/v1.0/capabilities
    12 MAR 2019 03:59:34,747 INFO [connectThread] XmppConnection - >XmppConnection
    12 MAR 2019 03:59:35,06 INFO [main] RESTAsyncRequest - Response size is: 9609 for request: https://openrainbow.com/api/rainbow/enduser/v1.0/users/5c1ca990e1c0c55e040b59a9/profiles/features

    0
    Actions pour les commentaires Permalien
  • Jérôme Gully

    Hi,

    In your last log there is no errror (maybe a text limit for the message ?) and your problem seams to be resolved, you have the line "Authentication Success ", you don't have anymore the initial error "Exception not managed; JSONObject["guestMode"] not a string.  | Infrastructure - Authentication Failure".

    0
    Actions pour les commentaires Permalien
  • Muhammad Syahroyni

    Hi,

    Actually, when login listener called I show an alert either the login success or not. But the app force close when login still processes and the alert didn't show. So I assume something happens before the login listener called.

    0
    Actions pour les commentaires Permalien
  • Jérôme Gully

    Can you try with only a log print with Log.d() and show if its work ? Maybe you call AlertDialog (or UI work) outside the UI Thread.

    By the way, if you can put here the logcat of your crash, it can help me resolves the problem.

    0
    Actions pour les commentaires Permalien
  • Muhammad Syahroyni

    I already print the logcat and found these errors : 

    No interface method i()I in class 
    Landroid/content/res/XmlResourceParser; or its super classes (declaration of 
    'android.content.res.XmlResourceParser' appears in 
    /system/framework/framework.jar)

    and

    java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.jivesoftware.smack.initializer.VmArgInitializer

    I assume the problem is same like the JSON problem. So I try to keep the class in proguard like your answer for JSON problem.

    -keep class org.xmlpull.v1.** { *;}
    -keep class org.jivesoftware.smack.** {*;}
    -keep class org.jivesoftware.smackx.** {*;}

    And it works.

    Thank you for your help Jerome

    0
    Actions pour les commentaires Permalien
  • Jérôme Gully

    Nice to see you have resolved your problem :)

    0
    Actions pour les commentaires Permalien

Vous devez vous connecter pour laisser un commentaire.

Vous n'avez pas trouvé ce que vous cherchez?

  • Contactez-nous

    Vous avez des questions? Laissez-nous un message pour obtenir plus d'informations.

    Contactez-nous
  • Demandez à la Communauté

    Vous avez besoin d'aide? Posez vos questions à la Communauté et obtenez des réponses d'autres utilisateurs Rainbow.

    Poster un message