0

I have been trying to create an app which takes data from TheMovieDB API and displays it on my Android application, I have no idea what I am doing.

All the tutorials on youtube have not helped for my needs.

How can import the files from themoviedbapi by holgerbrandl from GitHub into my application?

I have tried to add the dependencies to Gradle and use some of the basic functions such as

TmdbMovies movies = new TmdbApi("<apikey>").getMovies();
MovieDb movie = movies.getMovie(5353, "en");

However, it just won't work, the error it throws is:

Error:Execution failed for task':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: C:\Users\zdroa\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.4.4\d3dad1a494f94579fca4b6a1142fb15fb68f0b2f\jackson-annotations-2.4.4.jar
File2: C:\Users\zdroa\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.4.4\c5cd3347c0a86d0dcfbf3da593d8431d5a789d54\jackson-core-2.4.4.jar
File3: C:\Users\zdroa\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.4.4\e2ff13c3de2f5a2ab2449a3dace2b0d1c37bd8ee\jackson-databind-2.4.4.jar

I'm pretty new to Java and programming Android applications. I have managed to get a register script working so far and login for my application. After the user logs in a basic list of movies, from the TMDB API will appear on the screen and they can then further perform their own queries on the API.

This is the activity where I used the TmdbMovies, TmdbApi and MovieDB which is causing the error.

package com.example.zdroa.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.TextView;

import info.movito.themoviedbapi.TmdbApi;
import info.movito.themoviedbapi.TmdbMovies;
import info.movito.themoviedbapi.model.MovieDb;

public class TestActivity extends AppCompatActivity {

    TextView tv;
    Button b;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        TmdbMovies movies = new TmdbApi("<apikey>").getMovies();
        MovieDb movie = movies.getMovie(5353, "en");

    }
}

Note I am not asking someone to do it for me, however, after a whole night of looking for guides and tutorials and any sort of help, I can no longer take this. Can someone point me in the right direction, please?

I have an API key, what I need to understand is how to use that library/wrapper or if there is a simpler way, how to do it.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Or this http://stackoverflow.com/questions/22467127/error-duplicate-files-during-packaging-of-apk – OneCricketeer Apr 29 '17 at 05:09
  • @cricket_007 but why does this happen? if i take out compile group: 'info.movito', name: 'themoviedbapi', version:'1.4' from grade and remove that code i quoted above the application works, as soon as i compile themoviedbapi it messes it up – Sebastian Zdroana Apr 29 '17 at 05:10
  • Because that code has *transitive dependencies* on some `jackson` JSON code – OneCricketeer Apr 29 '17 at 05:12

0 Answers0