I am connecting to PostgreSQL using JDBC in Android Studio. I have downloaded latest versions of driver and added in libs folder. I added JAR as library and added to dependency. I have added all internet permission and gave port no 5432 and IPV4 address of my laptop while connecting to my mobile. But, I am getting errors in classloader.java file as java Lang Management Factory not found, etc. I am debugging the same from 72 hours but I didn't got the resolution.
Asked
Active
Viewed 64 times
-1
-
AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.management.Managem entFactory" on path: DexPathList – Piyush068 Jan 15 '22 at 09:44
-
Please include the complete error message in the question itself, not in the comments. Edit the question and include it. – kiner_shah Jan 15 '22 at 09:45
-
String jdbcUrl = "jdbc:postgresql://222.222.0.123:5432/Test"; String username = "postgres"; String password ="postgres"; Class.forName("oracle.jdbc.driver.OracleDriver"); Thread thread = new Thread(new Runnable() { @Override public void run() { try { Connection conn = null; conn = DriverManager.getConnection(jdbcUrl, username, password); – Piyush068 Jan 15 '22 at 09:46
-
There is an edit button there, please click it and add the code, error messages, etc. in the question itself. – kiner_shah Jan 15 '22 at 09:47
-
@kiner_shah added images first one error second and third code followed by gradle and manifest last jdbc driver – Piyush068 Jan 15 '22 at 11:44
-
Don't post code, error messages as images. Copy and paste them into the post. – kiner_shah Jan 15 '22 at 12:04
-
when I am adding it into post, it is saying wrong alignment formatting etc and ts taking too much time to format so posted as images – Piyush068 Jan 15 '22 at 12:19
-
and images are totaly visible as it is captured using snipping tool – Piyush068 Jan 15 '22 at 12:19
-
Please [reconsider using JDBC in an Android app](https://stackoverflow.com/questions/15853367/jdbc-vs-web-service-for-android). – CommonsWare Jan 15 '22 at 13:02
-
@CommonsWare but if Iwant to do quickly because I dont know web service – Piyush068 Jan 15 '22 at 13:04
-
@Piyush068, you can use online code formatting tools to format your code. – kiner_shah Jan 16 '22 at 06:02
-
Please provide enough code so others can better understand or reproduce the problem. – Community Jan 24 '22 at 09:11
1 Answers
0
I found that latest version of JAR was not compatible with Android. I worked fine when I used some older version of driver.

Piyush068
- 1
- 2