java.lang.SecurityException: Prohibited package name: java.sql

#1

I have a problem with SQL connection via JDBC in Kotlin in IntellijIDEA 2018.3.2 and have been working and googleing about it for days and still have got nothing. I created a package named ‘com.myapp.test’ and used JDBC for connecting to SQLServer and fetch data. Problem is that building project reports no errors but when trying to run it in emulator gives a strange build exception.

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:transformClassesWithInstantRunForDebug’.
com.android.build.api.transform.TransformException:
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.SecurityException: Prohibited package name: java.sql

I tried changing target java SDK from 6 to 11 and many other tricks like naming for imported classes like:

import java.sql.ResultSet as jsqlRes

class myClass{
    val myRes:jsqlRes
    and.....
}


but the problem still exists. 

have any idea what can i do to fix this problem?
#2

That usually means that you are creating a class in that package. Are you sure all your classes are in the com.myapp.test package?

#3

All classes of project are in same package called ‘com.myapp.test’.
I guess this is not a package naming problem. this must be a kotlin or java thing or anything else.
I tried various package names and also stared a new empty project for test and got no answers.
Seems like Kotlin or java gone crazy wherever i use this java.sql namespace imports.

#4

Please upload a project that shows that behaviour somewhere. I’m still convinced that you have a incorrect package statement somewhere. Have you tried searching your code for package java.sql or something similar?