Search Unity

[Solved] Android App won't build

Discussion in 'Unity IAP' started by winjw7, Nov 15, 2017.

Thread Status:
Not open for further replies.
  1. winjw7

    winjw7

    Joined:
    Nov 17, 2014
    Posts:
    5
    Some reason when I build my app with gradle and I have the in app purchase service imported it won't build, I delete the service from my assets and it builds successfully again... I've tried both 2017.2, and the beta 2017.3 but can't seem to get it to work... any suggestions ?
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Console log?

    Build log?
     
  3. winjw7

    winjw7

    Joined:
    Nov 17, 2014
    Posts:
    5
    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_152\bin\java.exe -classpath "C:\Program Files\Unity 2017.3.0b9\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

    stderr[
    Note: there were 11 duplicate class definitions.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
    Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    Warning: there were 10 unresolved references to classes or interfaces.
    You may need to add missing library jars or update their versions.
    If your code works fine without the missing classes, you can suppress
    the warnings with '-dontwarn' options.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'.
    > Job failed, see logs for details

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED in 3s
    ]
    stdout[
    NDK is missing a "platforms" directory.
    If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\NVPACK\android-sdk-windows\ndk-bundle.
    If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

    The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
    The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
    The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
    :preBuild UP-TO-DATE
    :extractProguardFiles
    :preReleaseBuild
    :checkReleaseManifest
    :preDebugBuild UP-TO-DATE
    :prepareCommonLibrary
    :prepareGoogleAIDLLibrary
    :prepareGooglePlayLibrary
    :prepareUnityAdsLibrary
    :prepareReleaseDependencies
    :compileReleaseAidl UP-TO-DATE
    :compileReleaseRenderscript UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources UP-TO-DATE
    :mergeReleaseResources UP-TO-DATE
    :processReleaseManifest
    :processReleaseResources
    :generateReleaseSources
    :incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
    :javaPreCompileRelease
    :compileReleaseJavaWithJavac UP-TO-DATE
    :compileReleaseNdk NO-SOURCE
    :compileReleaseSources UP-TO-DATE
    :lintVitalRelease
    :mergeReleaseShaders UP-TO-DATE
    :compileReleaseShaders UP-TO-DATE
    :generateReleaseAssets UP-TO-DATE
    :mergeReleaseAssets
    :processReleaseJavaRes NO-SOURCE
    :transformResourcesWithMergeJavaResForRelease UP-TO-DATE
    :transformClassesAndResourcesWithProguardForRelease
    ProGuard, version 5.3.2
    Reading input...
    Reading program jar [C:\Unity\PlanetsBattle\Temp\gradleOut\libs\unity-classes.jar] (filtered)
    Reading program jar [C:\Users\Justin\.android\build-cache\aa99bb7eef9787b231ee3d39e177befab24ff9ae\output\jars\classes.jar] (filtered)
    Reading program jar [C:\Users\Justin\.android\build-cache\ec301e19cbccc9beb1f2cf9b5e95632aaf353dca\output\jars\classes.jar] (filtered)
    Reading program jar [C:\Users\Justin\.android\build-cache\7d9c228300fe62dcfe51e617c8d04b568d56af80\output\jars\classes.jar] (filtered)
    Reading program jar [C:\Users\Justin\.android\build-cache\0f4a91fa5e12ab1cd9d8cbcc35525710a6167ea8\output\jars\classes.jar] (filtered)
    Reading program directory [C:\Unity\PlanetsBattle\Temp\gradleOut\build\intermediates\classes\release] (filtered)
    Reading library jar [C:\NVPACK\android-sdk-windows\platforms\android-26\android.jar]
    Reading library jar [C:\NVPACK\android-sdk-windows\platforms\android-26\optional\org.apache.http.legacy.jar]
    Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParams]
    Note: duplicate definition of library class [org.apache.http.params.HttpParams]
    Note: duplicate definition of library class [org.apache.http.params.CoreConnectionPNames]
    Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
    Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
    Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
    Note: duplicate definition of library class [org.apache.http.conn.scheme.LayeredSocketFactory]
    Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
    Note: duplicate definition of library class [android.net.http.SslCertificate]
    Note: duplicate definition of library class [android.net.http.HttpResponseCache]
    Note: duplicate definition of library class [android.net.http.SslError]
    Initializing...
    Note: com.unity.purchasing.googleplay.GooglePlayPurchasing: can't find dynamically referenced class com.google.vr.ndk.base.DaydreamApi
    Note: the configuration explicitly specifies 'android.webkit.JavascriptInterface' to keep library class 'android.webkit.JavascriptInterface'
    Note: there were 1 library classes explicitly being kept.
    You don't need to keep library classes; they are already left unchanged.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
    Note: there were 1 unresolved dynamic references to classes or interfaces.
    You should check if you need to specify additional program jars.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
    Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
    :transformClassesAndResourcesWithProguardForRelease FAILED
    23 actionable tasks: 13 executed, 10 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
    UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What store are you targeting? Are you building for DayDream? If you are using Proguard, please add the following, either "-ignorewarnings" or "-keep class com.unity.purchasing.** { *; }"
     
  5. winjw7

    winjw7

    Joined:
    Nov 17, 2014
    Posts:
    5
    I'm using google play store and adding "-ignorewarnings" worked! Thanks for the help!
     
  6. julien-b

    julien-b

    Joined:
    May 8, 2015
    Posts:
    31
    Hi, same problem here, How do you add -ignorewarnings via the playersettings ?
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This thread title is marked as Solved, so probably best to open a new thread moving forward. -ignorewarnings goes in the Proguard file. When you select the Gradle option in the Editor when you Build, the Proguard option becomes available. The file is currently blank, so you can just add these lines.
     
Thread Status:
Not open for further replies.