Skip to content

Gradle cache causing conflicts with the original library #430

Description

@georgeedwards

I am building a Nativescript plugin, for android. When I add the Azure-Mobile-SDK (azure-mobile-android-3.1.0.jar), I get the following error:

:buildMetadata
Exception in thread "main" java.lang.IllegalArgumentException: Class com.microsoft.windowsazure.mobileservices.table.query.FunctionCallNodeMerger conflict: /Users/georgeedwards/.gradle/caches/modules-2/files-2.1/com.microsoft.azure/azure-mobile-android/3.1.0/ae6cfa31ba5a84141676d2d92fa64ca36c52d28/azure-mobile-android-3.1.0.jar and /Users/georgeedwards/Desktop/nativescript-plugin-seed-master/demo/node_modules/nativescript-yourplugin/platforms/android/azure-mobile-android-3.1.0.jar
    at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21)
    at com.telerik.metadata.Builder.build(Builder.java:38)
    at com.telerik.metadata.Generator.main(Generator.java:44)
:buildMetadata FAILED

FAILURE: Build failed with an exception.

It looks as though the cached version is conflicting with my original library and causing my build to fail - why is this happening and how can I stop it?

Update, if I don't list the library in my include.gradle, then I get the following output:

:buildMetadata
Skip com.microsoft.windowsazure.mobileservices.ApiJsonOperationCallback
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.MobileServiceClient
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.authentication.LoginManager
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.MobileServiceConnection
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.MobileServiceHttpClient
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.NextServiceFilterCallback
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.OkHttpClientFactory
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.OkHttpClientFactoryImpl
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.ServiceFilter
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.ServiceFilterRequest
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.ServiceFilterRequestImpl
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.ServiceFilterResponse
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.http.ServiceFilterResponseImpl
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.notifications.MobileServicePush
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.MobileServiceConflictExceptionJson
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.MobileServiceExceptionBase
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.MobileServiceJsonTable
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.MobileServicePreconditionFailedExceptionJson
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.MobileServiceTable
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.TableJsonQueryCallback
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.query.ExecutableJsonQuery
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.query.ExecutableQuery
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.serialization.DateSerializer
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.serialization.JsonEntityParser
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.serialization.LongSerializer
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceJsonSyncTable
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncTable
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.localstore.MobileServiceLocalStore
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.localstore.SQLiteLocalStore
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.AbstractTableOperation
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.DeleteOperation
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.LocalTableOperationProcessor
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.RemoteTableOperationProcessor
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.TableOperation
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.operations.TableOperationError
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.pull.IncrementalPullStrategy
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.pull.PullStrategy
    Error: java.lang.NullPxception
Skip com.microsoft.windowsazure.mobileservices.table.sync.queue.OperationQueue
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.synchandler.MobileServiceSyncHandler
    Error: java.lang.NullPointerException
Skip com.microsoft.windowsazure.mobileservices.table.sync.synchandler.SimpleSyncHandler
    Error: java.lang.NullPointerException
 'assets/metadata/treeNodeStream.dat'...
 'assets/metadata/treeStringsStream.dat'...
 'assets/metadata/treeValueStream.dat'...
:transformClassesWithDexForDebug

But it builds successfully - any ideas why the include is an issue?

Activity

  1. georgeedwards commented on Apr 25, 2016

    @georgeedwards
    Author

    If I use a different version of the SDK I get:

    :buildMetadata
    Exception in thread "main" java.lang.IllegalArgumentException: Class com.tns.internal.AppBuilderCallback conflict: C:\Users\George\nativescript-plugin-seed-master\demo\platforms\android\build\intermediates\classes\yourplugin\debug and C:\Users\George\nativescript-plugin-seed-master\demo\platforms\android\build\intermediates\classes\nativescriptazure\debug
            at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21)
            at com.telerik.metadata.Builder.build(Builder.java:41)
            at com.telerik.metadata.Generator.main(Generator.java:44)
    :buildMetadata FAILED
    
  2. Plamen5kov commented on Apr 27, 2016

    @Plamen5kov
    Contributor

    Hi @georgeedwards,
    The reason behind this error:

    Exception in thread "main" java.lang.IllegalArgumentException: Class com.microsoft.windowsazure.mobileservices.table.query.FunctionCallNodeMerger conflict: /Users/georgeedwards/.gradle/caches/modules-2/files-2.1/com.microsoft.azure/azure-mobile-android/3.1.0/ae6cfa31ba5a84141676d2d92fa64ca36c52d28/azure-mobile-android-3.1.0.jar and /Users/georgeedwards/Desktop/nativescript-plugin-seed-master/demo/node_modules/nativescript-yourplugin/platforms/android/azure-mobile-android-3.1.0.jar
        at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21)
        at com.telerik.metadata.Builder.build(Builder.java:38)
        at com.telerik.metadata.Generator.main(Generator.java:44)
    :buildMetadata FAILED
    

    Is that there are two jars that define the same types. (in the common scenario these jars are the same).
    I couldn't reproduce your problem, but i tried adding the asure library you're using to the project, like so:

    • go to /app/App_Resources/Android/
    • open app.gradle
    • uncomment the dependencies configuration and replace the example string with com.microsoft.azure:azure-mobile-android:3.1.0
      (your file should look like this:)
    dependencies {
        compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
    }
    
    android {  
      defaultConfig {  
        generatedDensities = []  
      }  
      aaptOptions {  
        additionalParameters "--no-version-vectors"  
      }  
    } 
    
    • run the build tns run android

    For the second error:

    :buildMetadata
    Exception in thread "main" java.lang.IllegalArgumentException: Class com.tns.internal.AppBuilderCallback conflict: C:\Users\George\nativescript-plugin-seed-master\demo\platforms\android\build\intermediates\classes\yourplugin\debug and C:\Users\George\nativescript-plugin-seed-master\demo\platforms\android\build\intermediates\classes\nativescriptazure\debug
            at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21)
            at com.telerik.metadata.Builder.build(Builder.java:41)
            at com.telerik.metadata.Generator.main(Generator.java:44)
    :buildMetadata FAILED
    

    You need to do a clean after you change a dependency like the SDK.
    You can do that in two ways:

    • go to platforms/android/ and running the command: gradlew clean for windows and ./gradlew clean for linux.
    • go to platforms/android/ and delete the build folder.

    PS: soon there will be a tns android clean command that will do this job for your.

  3. georgeedwards commented on Apr 27, 2016

    @georgeedwards
    Author

    Ahh, that's solved it - Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions