• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android error: cannot find symbol for java extension

Greetings,

i am trying to create an extension so i can use appsflyer and have no real experience in how to use java

when i attempt to compile a blank game file with only a room and the extension in it i get the following errors.

Code:
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:24: error: cannot find symbol
		Map<String, Object> eventValue = new HashMap<String, Object>();
		^
  symbol:   class Map
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:24: error: cannot find symbol
		Map<String, Object> eventValue = new HashMap<String, Object>();
		                                     ^
  symbol:   class HashMap
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:25: error: cannot find symbol
		eventValue.put(AFInAppEventParameterName.LEVEL,level);
		               ^
  symbol:   variable AFInAppEventParameterName
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:26: error: cannot find symbol
		eventValue.put(AFInAppEventParameterName.LABEL,label);
		               ^
  symbol:   variable AFInAppEventParameterName
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:27: error: cannot find symbol
		eventValue.put(AFInAppEventParameterName.SCORE,score);
		               ^
  symbol:   variable AFInAppEventParameterName
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:28: error: cannot find symbol
		AppsFlyerLib.getInstance().trackEvent(context,AFInAppEventType.LEVEL_ACHIEVED,eventValue);
		                                      ^
  symbol:   variable context
  location: class AppsFlyerClass
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:28: error: cannot find symbol
		AppsFlyerLib.getInstance().trackEvent(context,AFInAppEventType.LEVEL_ACHIEVED,eventValue);
		                                              ^
  symbol:   variable AFInAppEventType
  location: class AppsFlyerClass
and here is the .java file im trying to use

Code:
package ${YYAndroidPackageName};

import android.util.Log;
import java.lang.String;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;
import ${YYAndroidPackageName}.RunnerActivity;

import com.appsflyer.AppsFlyerLib;

public class AppsFlyerClass extends Activity 
{

	public void startTracking( String key, String app)
	{
		AppsFlyerLib.getInstance().startTracking(this.getApplication(),key);
	}

	public static void trackEvent(String level, String label, String score)
	{
		Map<String, Object> eventValue = new HashMap<String, Object>();
		eventValue.put(AFInAppEventParameterName.LEVEL,level);
		eventValue.put(AFInAppEventParameterName.LABEL,label);
		eventValue.put(AFInAppEventParameterName.SCORE,score);
		AppsFlyerLib.getInstance().trackEvent(context,AFInAppEventType.LEVEL_ACHIEVED,eventValue);
	}

}
does anyone know what im doing wrong and how to make the machine find the correct symbols?

thank you.
 

FrostyCat

Redemption Seeker
You haven't imported java.util.* and com.appsflyer.AFInAppEventParameterName, and context hasn't been defined.

Seriously, learn some basic Java before pressing ahead with this, or pay someone else to do it. There's a reason why virtually every book on Android development comes with a disclaimer that they assume prior Java experience.
 
ok i have made some headway, now im only having one error appear

Code:
Y:\com.companyname.Project2\src\main\java\com\companyname\Project2\AppsFlyerClass.java:24: error: cannot find symbol
public static void trackEvent(Context context, String level, String score)
                              ^
  symbol:   class Context
  location: class AppsFlyerClass
Code:
package ${YYAndroidPackageName};

import android.util.Log;
import java.lang.String;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;
import ${YYAndroidPackageName}.RunnerActivity;

import com.appsflyer.*;

import java.util.*;

public class AppsFlyerClass extends Activity 
{
public void startTracking( String key, String app )
	{
	AppsFlyerLib.getInstance().startTracking(this.getApplication(),key);
	}

public static void trackEvent(Context context, String level, String score)
	{
	Map<String, Object> eventValue = new HashMap<String, Object>();
	eventValue.put(AFInAppEventParameterName.LEVEL,level);
	eventValue.put(AFInAppEventParameterName.SCORE,score);
	AppsFlyerLib.getInstance().trackEvent(context, AFInAppEventType.LEVEL_ACHIEVED, eventValue);
	}
}
im pretty sure i do need context in order to get this to function and its suppose to pull up the command

Code:
getApplicationContext()
but am shooting in the dark because when i try to pull that up it begins talking about static.

slowly but surely

thank you.
 
Last edited:
Top