hippogamesunity / SimpleAndroidNotificationsPublic

This is public repository for Simple Android Notifications plugin for Unity
6 stars 0 forks source link

Gradle build error: A library uses the same package as this project: com.unity3d.player #17

Closed hayashiyui closed 6 years ago

hayashiyui commented 6 years ago

I do get a build error after updating to Unity 2018.1.0f2. When deleting the SimpleAndroidNotifications plugin, no error occurs.


CommandInvokationFailure: Gradle build failed. C:/Program Files/Java/jdk1.8.0_151\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

BUILD FAILED in 5s ] stdout[ 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 :prepareLunarConsoleLibrary :prepareSimpleAndroidNotificationsLibrary :prepareTweetComposer311Library :prepareTwitterCore311Library :prepareTwitterUnity311ReleaseLibrary :prepareReleaseDependencies :compileReleaseAidl UP-TO-DATE :compileReleaseRenderscript UP-TO-DATE :generateReleaseBuildConfig UP-TO-DATE :generateReleaseResValues UP-TO-DATE :generateReleaseResources UP-TO-DATE :mergeReleaseResources :processReleaseManifest :processReleaseResources FAILED 18 actionable tasks: 14 executed, 4 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.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action1 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)

hippogamesunity commented 6 years ago

Hi! Please check this issue on our github, there should be a workaround for you. Unity 2018 support will be added soon. Could you also leave your feedback on the asset store? Thanks

On Mon, May 7, 2018, 20:02 Yuichiro Hayashi notifications@github.com wrote:

I do get a build error after updating to Unity 2018.1.0f2. When deleting the SimpleAndroidNotifications plugin, no error occurs.

CommandInvokationFailure: Gradle build failed. C:/Program Files/Java/jdk1.8.0_151\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processReleaseResources'.

Error: A library uses the same package as this project: com.unity3d.player

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

BUILD FAILED in 5s ] stdout[ 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 :prepareLunarConsoleLibrary :prepareSimpleAndroidNotificationsLibrary :prepareTweetComposer311Library :prepareTwitterCore311Library :prepareTwitterUnity311ReleaseLibrary :prepareReleaseDependencies :compileReleaseAidl UP-TO-DATE :compileReleaseRenderscript UP-TO-DATE :generateReleaseBuildConfig UP-TO-DATE :generateReleaseResValues UP-TO-DATE :generateReleaseResources UP-TO-DATE :mergeReleaseResources :processReleaseManifest :processReleaseResources FAILED 18 actionable tasks: 14 executed, 4 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.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action1 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)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hippogamesunity/SimpleAndroidNotificationsPublic/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AG-qnNEejhv8GIgBzEWJXn2RcXAATFaMks5twEXhgaJpZM4T075I .

hippogamesunity commented 6 years ago

Did you try this? -keep class com.hippogames.simpleandroidnotifications. { ; }

hayashiyui commented 6 years ago

Thanks for your comment but I'm not using proguard. I guess about this build error below. The package name "com.unity3d.player" in AndroidManifest.xml in simple-android-notifications.aar is conflicting with unityplayer. I tested changing the package name to "com.hippogames.simpleandroidnotifications", and the gradle build error was resolved.

hippogamesunity commented 6 years ago

Fixed in 2.3 (will be available soon, after review).

TheOrestes commented 6 years ago

This issue still persists in 2018.2.0f2 with version 2.3 of plugin. I am trying to build DemoScene provided with the package. Hope to hear soon.

hippogamesunity commented 6 years ago

Hi! What value do you have inside AAR's manifest? image

TheOrestes commented 6 years ago

Yes, that's exactly what I have inside AAR's manifest. Am I missing anything else?

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hippogames.simpleandroidnotifications"
    android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-sdk android:minSdkVersion="15" />
    <application
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:largeHeap="true">
        <receiver android:name="com.hippogames.simpleandroidnotifications.Controller" />
    </application>
</manifest>
hippogamesunity commented 6 years ago

Well, you need to analyze the error in more details. At least your suggestion doesn't relate to this issue.

TheOrestes commented 6 years ago

Yes, you are right. I accidentally thought issue is similar due to Unity console log gave same error message for first few lines. Here is what I get as a pop-up while making a build.

builderror

Here is what Unity doc says about such issues: _A library can not freely override attributes from the main AndroidManifest.xml. Often this error is caused by a library setting the application icon or label string, similar to the Resource not found problem above.

Either remove the attribute from the library, or add a tools:replace attribute to your application tag, to indicate how the merge conflict should be resolved._

And here is the Unity log:

CommandInvokationFailure: Gradle build failed. C:/Program Files/Java/jdk1.8.0_162\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[ W:\ROOT16\Unity\AndroidNotification\Temp\gradleOut\src\main\AndroidManifest.xml:4:58-89 Error: Attribute application@icon value=(@mipmap/app_icon) from AndroidManifest.xml:4:58-89 is also present at [:simple-android-notifications:] AndroidManifest.xml:10:3-36 value=(@drawable/app_icon). Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:4:3-16:17 to override.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processReleaseManifest'.

    Manifest merger failed : Attribute application@icon value=(@mipmap/app_icon) from AndroidManifest.xml:4:58-89 is also present at [:simple-android-notifications:] AndroidManifest.xml:10:3-36 value=(@drawable/app_icon). Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:4:3-16:17 to override.

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

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s ] stdout[ :preBuild UP-TO-DATE :preReleaseBuild UP-TO-DATE :compileReleaseAidl UP-TO-DATE :compileReleaseRenderscript UP-TO-DATE :checkReleaseManifest UP-TO-DATE :generateReleaseBuildConfig UP-TO-DATE :prepareLintJar UP-TO-DATE :generateReleaseResValues UP-TO-DATE :generateReleaseResources UP-TO-DATE :mergeReleaseResources UP-TO-DATE :createReleaseCompatibleScreenManifests UP-TO-DATE :processReleaseManifest

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:processReleaseManifest FAILED 10 actionable tasks: 1 executed, 9 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.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1 progress) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, 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)

I am really not an Android native expert, hence any help will be much appreciated. If this is indeed a valid issue, I can raise a separate issue & not append here.

Thanks.

hippogamesunity commented 6 years ago

Yes, you can create an issue. But at first I would try to resolve conflicts. Did you try to remove the attribute?

VusalJalilov commented 5 years ago

Hello.

Unity 5.6.6f2. New Project. Clean install of the latest PAID version from the Unity Asset Store. Attempted to build the Demo scene.

CommandInvokationFailure: Gradle build failed. C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"

stderr[

] stdout[ #

There is insufficient memory for the Java Runtime Environment to continue.

Native memory allocation (malloc) failed to allocate 740816 bytes for Chunk::new

An error report file with more information is saved as:

D:\UnityProjects\IAP_2019\Temp\gradleOut\hs_err_pid20280.log

[thread 19980 also had an error] Incremental java compilation is an incubating feature. #

Compiler replay data is saved as:

D:\UnityProjects\IAP_2019\Temp\gradleOut\replay_pid20280.log

] exit code: 1 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.HostView:OnGUI()

hippogamesunity commented 5 years ago

Hi, will it build if you delete the asset?

VusalJalilov commented 5 years ago

It was all my fault.

1) I had issues with Java SDK that caused the Cradle Build error. 2) Forgot to edit small icon string that caused the app to crash

All is working now!

VusalJalilov commented 5 years ago

In case others have similar issues, building with jdk1.8.0_211 results in error. Try jdk1.8.0_131 as it worked for me.