flurry / unity-flurry-sdk

Unity plugin for Flurry SDK
Apache License 2.0
25 stars 5 forks source link

Android build requires dependencies. #4

Closed ReaperUnreal closed 4 years ago

ReaperUnreal commented 5 years ago

There seems to be a missing step in the docs for Android installation.

When just doing the basic installation we're getting this error during an Android build:

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2018.3.14f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.3.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
C:\Users\gcl\cgs\client\Temp\gradleOut\src\main\java\com\flurry\android\FlurryUnityApplication.java:25: error: cannot find symbol
import com.flurry.android.FlurryAgent;
                         ^
  symbol:   class FlurryAgent
  location: package com.flurry.android
C:\Users\gcl\cgs\client\Temp\gradleOut\src\main\java\com\flurry\android\FlurryUnityApplication.java:26: error: package com.flurry.android.marketing does not exist
import com.flurry.android.marketing.FlurryMarketingModule;

This seems to indicate a missing android dependency that needs to be added.

poting-oath commented 5 years ago

@ReaperUnreal In your $PROJ_ROOT/Assets/Plugins/Android folder, there are 2 aar files (flurry-analytics.aar and flurry-marketing.aar) that should have the required libraries. Are they still there? Or do you change Unity's searching path?

svendhhh commented 5 years ago

I'm getting this same error, and the two .aar files are indeed there, just next to the FlurryUnityApplication.java file in Assets/Plugins/Android... Does it make a difference that the Plugins folder has it's own "Plugins" assembly (rather than the predefined "Firstpass" one)?

svendhhh commented 5 years ago

Seems that my problem was that the .aar files didn't get included in the build because we in our gradle build did:

implementation fileTree(dir: 'libs', include: ['*.jar'], exclude: ['unity-classes.jar'])

which only included .jar files. I've changed it to:

implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'], exclude: ['unity-classes.jar'])

and now it compiles (and works) :)

poting-oath commented 5 years ago

@svendhhh Thanks for the info you provided! Yes, whenever you modify the Unity project default, the path needs to be updated. We will include this in the document. Thanks!

poting-oath commented 4 years ago

README with this note has been added in the release 2.0.0.