I am currently making a connection to a MySql database. Everything goes well in the editor, connection is created and requests are sent correctly. But after creating a build for android, nothing works. I opened adb logcat to see what was going on and found this error:
05-25 19:03:47.176 11925 11966 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35) 05-25 19:03:47.176 11925 11966 I Unity : 05-25 19:03:47.237 11925 11966 I Unity : START-------------------------------- 05-25 19:03:47.237 11925 11966 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35) 05-25 19:03:47.237 11925 11966 I Unity : 05-25 19:03:47.287 11925 11966 E Unity : Unable to find advapi32 05-25 19:03:47.458 11925 11966 E Unity : PlatformNotSupportedException: Operation is not supported on this platform. 05-25 19:03:47.458 11925 11966 E Unity : at MySql.Data.MySqlClient.MySqlConfiguration..cctor () [0x00000] in <c6d996d13b714bca9031ad07266ac074>:0 05-25 19:03:47.458 11925 11966 E Unity : Rethrow as TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. 05-25 19:03:47.458 11925 11966 E Unity : at MySql.Data.MySqlClient.Replication.ReplicationManager..cctor () [0x0001e] in <c6d996d13b714bca9031ad07266ac074>:0 05-25 19:03:47.458 11925 11966 E Unity : Rethrow as TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. 05-25 19:03:47.458 11925 11966 E Unity : at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0016c] in <c6d996d13b714bca9031ad07266ac074>:0 05-25 19:03:47.458 11925 11966 E Unity : at DataBaseConnector.Start () [0x00031] in <d9c30f043e7e4454a72a12dfc0c90991>:0
I think that all this is because of "Unable to find advapi32" and as far as I understand it appears at the moment when I transfer ConnectionString to MySqlConnection object. Code with connection provided below.
private string ConnectionString;
private string dbName = "***";
private string dbUsername = "***";
private string dbPassword = "***";
private string dbServer = "***";
private string dbPort = "***";
public TextMeshProUGUI debug;
Account account;
MySqlConnection conn;
MySqlDataReader reader;
private void Awake()
{
ConnectionString = string.Format("server={0};port={1};uid={2};pwd={3};database={4}",
dbServer,
dbPort,
dbUsername,
dbPassword,
dbName
);
}
void Start()
{
conn = new MySqlConnection();
print("START--------------------------------");
conn.ConnectionString = ConnectionString;
conn.Open();
account = new Account();
}