question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build Failed: cannot find symbol

See original GitHub issue

I run cordova build ionic cordova build android --prod and get error below ` E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:563: error: cannot find symbol @TargetApi(Build.VERSION_CODES.KITKAT) ^ symbol: variable KITKAT location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\BackgroundExt.java:153: error: cannot find symbol @TargetApi(Build.VERSION_CODES.LOLLIPOP) ^ symbol: variable LOLLIPOP location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:189: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { ^ symbol: variable JELLY_BEAN_MR2 location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:190: error: cannot find symbol handlerThread.quitSafely(); ^ symbol: method quitSafely() location: variable handlerThread of type HandlerThread E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:198: error: method does not override or implement a method from a supertype @Override ^ E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:207: error: cannot find symbol super.onTaskRemoved(rootIntent); ^ symbol: method onTaskRemoved(Intent) E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:421: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ^ symbol: variable HONEYCOMB location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\LocationService.java:422: error: cannot find symbol task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, location); ^ symbol: variable THREAD_POOL_EXECUTOR location: class AsyncTask E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:55: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ^ symbol: variable JELLY_BEAN_MR1 location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:56: error: cannot find symbol elapsedRealtimeNanos = location.getElapsedRealtimeNanos(); ^ symbol: method getElapsedRealtimeNanos() location: variable location of type Location E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:58: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { ^ symbol: variable JELLY_BEAN_MR2 location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:59: error: cannot find symbol isFromMockProvider = location.isFromMockProvider(); ^ symbol: method isFromMockProvider() location: variable location of type Location E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:567: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ^ symbol: variable JELLY_BEAN_MR1 location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:568: error: cannot find symbol l.setElapsedRealtimeNanos(elapsedRealtimeNanos); ^ symbol: method setElapsedRealtimeNanos(long) location: variable l of type Location E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundLocation.java:592: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ^ symbol: variable JELLY_BEAN_MR1 location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\sqlite\SQLiteLocationDAO.java:113: error: method queryNumEntries in class DatabaseUtils cannot be applied to given types; return DatabaseUtils.queryNumEntries(db, LocationEntry.TABLE_NAME, whereClause, whereArgs); ^ required: SQLiteDatabase,String found: SQLiteDatabase,String,String,String[] reason: actual and formal argument lists differ in length E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\sqlite\SQLiteLocationDAO.java:154: error: cannot find symbol db.beginTransactionNonExclusive(); ^ symbol: method beginTransactionNonExclusive() location: variable db of type SQLiteDatabase E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\sqlite\SQLiteOpenHelper.java:118: error: cannot find symbol Log.d(TAG, "Creating db: " + this.getDatabaseName()); ^ symbol: method getDatabaseName() E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\data\sqlite\SQLiteOpenHelper.java:172: error: method does not override or implement a method from a supertype @Override ^ E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\HttpPostService.java:59: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ^ symbol: variable KITKAT location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\sync\BatchManager.java:70: error: cannot find symbol db.beginTransactionNonExclusive(); ^ symbol: method beginTransactionNonExclusive() location: variable db of type SQLiteDatabase E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\sync\SyncAdapter.java:71: error: constructor AbstractThreadedSyncAdapter in class AbstractThreadedSyncAdapter cannot be applied to given types; super(context, autoInitialize, allowParallelSyncs); ^ required: Context,boolean found: Context,boolean,boolean reason: actual and formal argument lists differ in length E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\marianhello\bgloc\sync\SyncService.java:60: error: cannot find symbol settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false); ^ symbol: variable SYNC_EXTRAS_DO_NOT_RETRY location: class ContentResolver E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:148: error: cannot find symbol criteria.setHorizontalAccuracy(translateDesiredAccuracy(config.getDesiredAccuracy())); ^ symbol: method setHorizontalAccuracy(Integer) location: variable criteria of type Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:166: error: cannot find symbol if (provider != LocationManager.PASSIVE_PROVIDER) { ^ symbol: variable PASSIVE_PROVIDER location: class LocationManager E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:187: error: cannot find symbol accuracy = Criteria.ACCURACY_LOW; ^ symbol: variable ACCURACY_LOW location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:190: error: cannot find symbol accuracy = Criteria.ACCURACY_MEDIUM; ^ symbol: variable ACCURACY_MEDIUM location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:193: error: cannot find symbol accuracy = Criteria.ACCURACY_HIGH; ^ symbol: variable ACCURACY_HIGH location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:196: error: cannot find symbol accuracy = Criteria.ACCURACY_HIGH; ^ symbol: variable ACCURACY_HIGH location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:199: error: cannot find symbol accuracy = Criteria.ACCURACY_MEDIUM; ^ symbol: variable ACCURACY_MEDIUM location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:463: error: cannot find symbol criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH); ^ symbol: variable ACCURACY_HIGH location: class Criteria E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\bgloc\DistanceFilterLocationProvider.java:467: error: cannot find symbol locationManager.requestSingleUpdate(criteria, singleUpdatePI); ^ symbol: method requestSingleUpdate(Criteria,PendingIntent) location: variable locationManager of type LocationManager E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:535: error: cannot find symbol activity.bindService(locationServiceIntent, mConnection, Context.BIND_IMPORTANT); ^ symbol: variable BIND_IMPORTANT location: class Context E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:569: error: cannot find symbol return getContext().registerReceiver(locationModeChangeReceiver, new IntentFilter(LocationManager.MODE_CHANGED_ACTION)); ^ symbol: variable MODE_CHANGED_ACTION location: class LocationManager E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:585: error: cannot find symbol Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); ^ symbol: variable ACTION_APPLICATION_DETAILS_SETTINGS location: class Settings E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:598: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ^ symbol: variable KITKAT location: class VERSION_CODES E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:599: error: cannot find symbol locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); ^ symbol: variable LOCATION_MODE location: class Secure E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\com\tenforwardconsulting\cordova\BackgroundGeolocationPlugin.java:600: error: cannot find symbol return locationMode != Settings.Secure.LOCATION_MODE_OFF; ^ symbol: variable LOCATION_MODE_OFF location: class Secure E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\BackgroundExt.java:161: error: cannot find symbol List<AppTask> tasks = am.getAppTasks(); ^ symbol: class AppTask location: class BackgroundExt E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\BackgroundExt.java:161: error: cannot find symbol List<AppTask> tasks = am.getAppTasks(); ^ symbol: method getAppTasks() location: variable am of type ActivityManager E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\ForegroundService.java:164: error: cannot find symbol Notification.Builder notification = new Notification.Builder(context) ^ symbol: class Builder location: class Notification E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\ForegroundService.java:164: error: cannot find symbol Notification.Builder notification = new Notification.Builder(context) ^ symbol: class Builder location: class Notification E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\ForegroundService.java:171: error: cannot find symbol notification.setPriority(Notification.PRIORITY_MIN); ^ symbol: variable PRIORITY_MIN location: class Notification E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\de\appplant\cordova\plugin\background\ForegroundService.java:176: error: cannot find symbol new Notification.BigTextStyle().bigText(text)); ^ symbol: class BigTextStyle location: class Notification E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\io\ionic\keyboard\IonicKeyboard.java:89: error: cannot find symbol display.getSize(size); ^ symbol: method getSize(Point) location: variable display of type Display E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\org\apache\cordova\device\Device.java:132: error: cannot find symbol String serial = android.os.Build.SERIAL; ^ symbol: variable SERIAL location: class Build E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\org\apache\cordova\splashscreen\SplashScreen.java:290: error: cannot find symbol LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); ^ symbol: variable MATCH_PARENT location: class LayoutParams E:\Mine\Projects\map-ionic\platforms\android\app\src\main\java\org\apache\cordova\splashscreen\SplashScreen.java:290: error: cannot find symbol LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); ^ symbol: variable MATCH_PARENT location: class LayoutParams Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 50 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • 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 25s (node:14172) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. `

I don’t know why to occur this issue Someone help me. Many thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:23 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
TraceDeTrailcommented, Feb 5, 2018

The workaround in logtofile.gradle : dependencies { compile ‘com.github.tony19:logback-android-core:1.1.1-6’ compile(‘com.github.tony19:logback-android-classic:1.1.1-6’) { exclude group: ‘com.google.android’, module: ‘android’ } compile ‘org.slf4j:slf4j-api:1.7.21’ }

8reactions
StingerID4commented, Jan 16, 2018

Finally found it, @sherlockat was correct. Altought it took me some time to find out where you could change that.

It’s found in /platforms/android/app/build.gradle

set the following values:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Resolve The Cannot Find Symbol Error in Java - Rollbar
As its name implies, the cannot find symbol error refers to a symbol which cannot be found. While there are multiple ways and...
Read more >
java - What does a "Cannot find symbol" or "Cannot resolve ...
A "Cannot find symbol" error means that the compiler cannot do this. Your code appears to be referring to something that the compiler...
Read more >
What can cause the "cannot find symbol" error in Java?
The “cannot find symbol” error occurs mainly when we try to reference a variable that is not declared in the program which we...
Read more >
What Causes “Cannot find symbol” Compilation Error in Java?
As the name suggests, the Java cannot find symbol error occurs when a required symbol cannot be found in the symbol table. Although...
Read more >
"Cannot Find Symbol" compile error - Net-Informations.Com
The "Cannot find symbol" errors generally occur when you try to reference an undeclared variable in your code. A "Cannot find symbol" error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found