Error:Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code. This is caused by library dependencies that have been compiled using Java 8 or above. If you are using the 'java' gradle plugin in a library submodule add targetCompatibility = '1.7' sourceCompatibility = '1.7' to that submodule's build.gradle file. 

Judging by the error you need to add targetCompatibility and sourceCompatibility in the gradle. How can this be done? If you can give an example, please.

Gradle file

 configurations.maybeCreate("default") artifacts.add("default", file('sqljdbc42.jar')) android { compileOptions { targetCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7 } } 

    1 answer 1

    In the build.gradle of your module you need to add

     android{ ...... compileOptions{ targetCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7 } } 
    • And you can detail, something does not work. Here is my gradle configurations.maybeCreate ("default") artifacts.add ("default", file ('sqljdbc42.jar')) android {compileOptions {targetCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7} This has resulted in a graft drawing, which has been done, and there is no such pattern, which is enough to draw a page, and you need to draw a page to draw a page, and you can draw a page to draw a page, and you can draw a page, and you can draw a page, and you can draw a page, and you can draw a page, and you can draw a page, and you can draw a page, and you can draw a page, and you will need to draw a page, and you will have to draw a page, and you will have to draw a page, and you will have to draw a page, and you will have to draw a page, and make a drawing like this. and sourceCompatibility emphasizes and knocks out the Gradle DSL error method not found: android () - Kirill Avdeev
    • This should be written in the module's build.gradle, and not in the project file (you have two of them there, one marked as Project: project_name, and the second Module: app) - rjhdby
    • The fact is that he registered in the module's gradle file - Kirill Avdeev
    • @ Kirill Avdeev And put the inside of the file in the post. The comments are completely impossible to read. But in general, an error suggests a syntax error. Hradle usually reacts to them like this - rjhdby
    • updated the question, attached the gradle module file - Kirill Avdeev