Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When buiild generate Apk error: cannot find symbol android.app.NotificationChannel #227

Closed
khanhvt1 opened this issue Jul 5, 2018 · 9 comments
Labels
stale auto labeled abandoned issues after a period of inactivity

Comments

@khanhvt1
Copy link

khanhvt1 commented Jul 5, 2018

Your Environment

  • Plugin version: 0.5.0-alpha.34
  • Platform: Android
  • OS version: 7.0
  • Device manufacturer and model: Xiaomi Red 5A
  • React Native version: 0.55.4
  • Plugin configuration options:
  • Link to your project:

Context

node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:4: error: cannot find symbol
import android.app.NotificationChannel;

Details :
symbol: class NotificationChannel
location: package android.app
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:86: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
^
symbol: variable O
location: class VERSION_CODES
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:89: error: cannot find symbol
NotificationChannel serviceChannel = new NotificationChannel(SERVICE_CHANNEL_ID, appName, android.app.NotificationManager.IMPORTANCE_DEFAULT);
^
symbol: class NotificationChannel
location: class NotificationHelper
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:89: error: cannot find symbol
NotificationChannel serviceChannel = new NotificationChannel(SERVICE_CHANNEL_ID, appName, android.app.NotificationManager.IMPORTANCE_DEFAULT);
^
symbol: class NotificationChannel
location: class NotificationHelper
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:89: error: cannot find symbol
NotificationChannel serviceChannel = new NotificationChannel(SERVICE_CHANNEL_ID, appName, android.app.NotificationManager.IMPORTANCE_DEFAULT);
^
symbol: variable IMPORTANCE_DEFAULT
location: class NotificationManager
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:96: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
^
symbol: variable O
location: class VERSION_CODES
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:100: error: cannot find symbol
NotificationChannel syncChannel = new NotificationChannel(SYNC_CHANNEL_ID, SYNC_CHANNEL_NAME, android.app.NotificationManager.IMPORTANCE_DEFAULT);
^
symbol: class NotificationChannel
location: class NotificationHelper
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:100: error: cannot find symbol
NotificationChannel syncChannel = new NotificationChannel(SYNC_CHANNEL_ID, SYNC_CHANNEL_NAME, android.app.NotificationManager.IMPORTANCE_DEFAULT);
^
symbol: class NotificationChannel
location: class NotificationHelper
C:\Project\ReactN\vanchuyen\node_modules\react-native-mauron85-background-geolocation\android\common\src\oreo\java\com\marianhello\bgloc\NotificationHelper.java:100: error: cannot find symbol
NotificationChannel syncChannel = new NotificationChannel(SYNC_CHANNEL_ID, SYNC_CHANNEL_NAME, android.app.NotificationManager.IMPORTANCE_DEFAULT);

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce

Context

I build app then it's not working as debug. Debug it still working. I can't test on many device
(Sorry, english my bad.)

Debug logs

@nguyensythinhk7
Copy link

I have the same issue? @mauron85 can i help you?

@manvi-ivnam
Copy link
Contributor

Which version of Android SDK is used in the project?

@mauron85
Copy link
Owner

mauron85 commented Jul 9, 2018

Check your sdk version.
Also if you're using gradle 4. Please also check #176 (comment)

@nguyensythinhk7
Copy link

nguyensythinhk7 commented Jul 9, 2018

@dobrynia , @mauron85 I use gradle 3.5.1
and config sdk version
compileSdkVersion 26
buildToolsVersion "26.0.2"
dexOptions {
jumboMode true
}
defaultConfig {
applicationId "com.xxx"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}

@mauron85
Copy link
Owner

mauron85 commented Jul 9, 2018

My comment is also true for gradle3.

@mauron85
Copy link
Owner

mauron85 commented Jul 9, 2018

Update your project to skeleton example mentioned in that thread i’ve linked, because I’ve doubts that gradle3 will work with latest android sdks

@starba3
Copy link

starba3 commented Aug 8, 2018

have the same issue
this is my build.gradle

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        applicationId "com.xxxxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            // minifyEnabled enableProguardInReleaseBuilds
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.1.1'
    }   
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}


dependencies {
    androidTestCompile 'com.android.support:support-annotations:23.1.1'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    compile project(':react-native-mauron85-background-geolocation')
    compile project(':react-native-background-timer')
    compile project(':react-native-background-task')
    compile project(':react-native-vector-icons')
    compile project(':react-native-push-notification')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.4.0"
    compile 'com.android.support:support-v4:+'
    compile "com.facebook.react:react-native:+"  // From node_modules
}

@stale
Copy link

stale bot commented Feb 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale auto labeled abandoned issues after a period of inactivity label Feb 4, 2019
@stale
Copy link

stale bot commented Feb 11, 2019

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

@stale stale bot closed this as completed Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale auto labeled abandoned issues after a period of inactivity
Projects
None yet
Development

No branches or pull requests

5 participants