Build Version Code O not being recognized correctly
I have this code snippet for my local notifications to work on Oreo devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
On my window desktop this is fine, no issues. However on my macbook, lint complains about NotificationChannel requiring SDK 26 and my min is 21. However if I change the version check to
if (Build.VERSION.SDK_INT >= 26)
the error goes away. I've tried restarting Android studio, clean/rebuild. Nothing works. When I do code inspection and use the suggested hints, its changing the Version_Code to 26. Its kinda bothering me having it act different on my 2 machines but same exact code. Anyone else seen this issue before?
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
minSdkVersion = 21
targetSdkVersion = 26
android android-studio android-8.0-oreo notification-channel
add a comment |
I have this code snippet for my local notifications to work on Oreo devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
On my window desktop this is fine, no issues. However on my macbook, lint complains about NotificationChannel requiring SDK 26 and my min is 21. However if I change the version check to
if (Build.VERSION.SDK_INT >= 26)
the error goes away. I've tried restarting Android studio, clean/rebuild. Nothing works. When I do code inspection and use the suggested hints, its changing the Version_Code to 26. Its kinda bothering me having it act different on my 2 machines but same exact code. Anyone else seen this issue before?
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
minSdkVersion = 21
targetSdkVersion = 26
android android-studio android-8.0-oreo notification-channel
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08
add a comment |
I have this code snippet for my local notifications to work on Oreo devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
On my window desktop this is fine, no issues. However on my macbook, lint complains about NotificationChannel requiring SDK 26 and my min is 21. However if I change the version check to
if (Build.VERSION.SDK_INT >= 26)
the error goes away. I've tried restarting Android studio, clean/rebuild. Nothing works. When I do code inspection and use the suggested hints, its changing the Version_Code to 26. Its kinda bothering me having it act different on my 2 machines but same exact code. Anyone else seen this issue before?
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
minSdkVersion = 21
targetSdkVersion = 26
android android-studio android-8.0-oreo notification-channel
I have this code snippet for my local notifications to work on Oreo devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
On my window desktop this is fine, no issues. However on my macbook, lint complains about NotificationChannel requiring SDK 26 and my min is 21. However if I change the version check to
if (Build.VERSION.SDK_INT >= 26)
the error goes away. I've tried restarting Android studio, clean/rebuild. Nothing works. When I do code inspection and use the suggested hints, its changing the Version_Code to 26. Its kinda bothering me having it act different on my 2 machines but same exact code. Anyone else seen this issue before?
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
minSdkVersion = 21
targetSdkVersion = 26
android android-studio android-8.0-oreo notification-channel
android android-studio android-8.0-oreo notification-channel
edited Apr 27 '18 at 11:48
Le2e410
asked Apr 27 '18 at 2:13
Le2e410Le2e410
113111
113111
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08
add a comment |
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08
add a comment |
2 Answers
2
active
oldest
votes
Same problem with android studio 3.2.1 after I switched from an old project to another. Very annoying. I solved with these steps:
- Delete {projectDir}/.idea/libraries folder
- File -> Sync Project with Gradle Files
- File -> Sync Project with File System
add a comment |
Oreo is android 8.
Instead your code, using below code:
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50054252%2fbuild-version-code-o-not-being-recognized-correctly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Same problem with android studio 3.2.1 after I switched from an old project to another. Very annoying. I solved with these steps:
- Delete {projectDir}/.idea/libraries folder
- File -> Sync Project with Gradle Files
- File -> Sync Project with File System
add a comment |
Same problem with android studio 3.2.1 after I switched from an old project to another. Very annoying. I solved with these steps:
- Delete {projectDir}/.idea/libraries folder
- File -> Sync Project with Gradle Files
- File -> Sync Project with File System
add a comment |
Same problem with android studio 3.2.1 after I switched from an old project to another. Very annoying. I solved with these steps:
- Delete {projectDir}/.idea/libraries folder
- File -> Sync Project with Gradle Files
- File -> Sync Project with File System
Same problem with android studio 3.2.1 after I switched from an old project to another. Very annoying. I solved with these steps:
- Delete {projectDir}/.idea/libraries folder
- File -> Sync Project with Gradle Files
- File -> Sync Project with File System
edited Nov 5 '18 at 11:15
answered Oct 30 '18 at 9:56
fireb86fireb86
563819
563819
add a comment |
add a comment |
Oreo is android 8.
Instead your code, using below code:
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
add a comment |
Oreo is android 8.
Instead your code, using below code:
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
add a comment |
Oreo is android 8.
Instead your code, using below code:
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
Oreo is android 8.
Instead your code, using below code:
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
CHANNEL_NAME,
level);
manager.createNotificationChannel(channel);
}
edited Nov 22 '18 at 19:19
סטנלי גרונן
1,76482245
1,76482245
answered Nov 22 '18 at 18:22
Majid ZareMajid Zare
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50054252%2fbuild-version-code-o-not-being-recognized-correctly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you set targetSdkVersion and if you set what is it
– sanemars
Apr 27 '18 at 2:48
Same question as above but for your compileSdkVersion, which needs to be at least 26 for this field to be available to you.
– stkent
Apr 27 '18 at 4:19
I added my gradle statements. Theyre the same on both computers, only the mac complains.
– Le2e410
Apr 27 '18 at 11:52
I reinstalled android studio and the error went away. I think the version number had something to do with it. It was on 2.3.1.
– Le2e410
Apr 28 '18 at 1:37
Possible duplicate of Android Studio 3.1: Erroneous unresolved references in editor
– fireb86
Nov 5 '18 at 11:08