last day (15 days later) » 

4:50 PM
0
A: Android Studio: Dependencies not included in Java module using Gradle 4.1

ישו אוהב אותךThis is a problem probably related with Android Gradle plug-in. Try using compile instead of implementation in yourbuild.gradle`: apply plugin: 'java' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.code.gson:gson:2.8.1' } sourceCompatibility = "1.7...

 
Thanks! When I switch back to Gradle plugin 2.3.3 and Gradle distribution version 3.3 and apply compile instead of implementation it works... However, I need to use the newest versions (3.0.0 and Gradle 4.1)... Any idea how to make it work there?
 
@jeff_bordon: I've made it works!
 
Thanks! However, I was unable to make it work, I even created a completely new project from the "New Project" dialog and added your files. Have you made it work with a new project?
 
I don't test it with a new project yet. I'm testing it with my library.
@jeff_bordon: I've created a new project and adding a java module. It's work for me.
 
Thanks, investigating further why it does not work... very strange
 
4:50 PM
@jeff_bordon: This is the project I've created with java module: github.com/isnotmenow/JavaPluginTest
 
Checked out your version - the main method works because it does not access Gson. As soon as I add Gson gson = new Gson() I get the exception again...
 
Strange... I also use gson in my library..
But only something like this:

Gson gson = new Gson();
Type type = new TypeToken<List<VaadinIcon>>() {}.getType();
List<VaadinIcon> fromJson = gson.fromJson(jsonString, type);
 
Does it work on your end if you do this from the Java module?
 
---
I've try adding the Gson, it's exactly like your problems. I got exception.
 
ah ok...
thanks, very strange :/
At least now I know it is not a problem with my Android Studio / Gradle installation
 
5:03 PM
That's really strange. Looks like this is become my problem also cause one of my library is using java module and gson to generate data.
 
5:17 PM
actually using artifacts.add("default", file('libs/gson-2.8.1.jar')) worked, however this is not the ideal solution
 
5:33 PM
Great! It's working. But this is really not an ideal solution like you've said. Very ugly hack :/
 

last day (15 days later) »