Search code examples
androidsql-serverjtds

SQL Server connection not working when release as a signed apk - android


In debug mode, I can connect to mssql server 2016. I'm using jtds jar file to connect android app with mssql. During generating signed apk, Android Studio said I am missing few class named XADataSource , etc.

Android Studio cannot resolve symbol of the following :

import javax.naming.Reference;
import javax.naming.Referenceable;
import javax.naming.StringRefAddr;
import javax.sql.XAConnection;
import javax.sql.XADataSource;

When apk generated, android app not connected to mssql, the connection to mssql not successful.


Solution

  • In proguard-rules.pro, I add following,

    -ignorewarnings
    
     -keep class * {
         public private *;
     }