Android的工作室无法导入WearableExtender NotificationManagerCompat和RemoteInput [英] Android studio unable to import WearableExtender NotificationManagerCompat and RemoteInput

查看:1160
本文介绍了Android的工作室无法导入WearableExtender NotificationManagerCompat和RemoteInput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目类以下的进口:

I have a project class with the following imports:

import android.app.Activity;
import android.app.Fragment;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.Action;
import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

在机器人工作室以下三个弹出一个无法解决符号错误:

In android studio the following three bring up a 'cannot resolve symbol' error:

import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;

Wierdly,在android.support.v4.app进口的NotificationCompat和NotificationCompat.Action是成功的。

Wierdly, the import for NotificationCompat and NotificationCompat.Action in android.support.v4.app are successful

import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.Action;

我曾尝试使用基于Eclipse相同的进口(指向相同SDK机器人工作室)和相同的工作,没有任何错误奔去。

I have tried to use the same imports on eclipse (pointing to the same SDK as android studio) and the same worked and ran without any errors.

我也试过<一个href=\"http://stackoverflow.com/questions/24406225/auto-import-not-working-for-android-classes-in-android-studio\">Minto's无效缓存解决方案 /重启机器人工作室......我的SDK是最新的在发帖的时间。感谢您的帮助提前

I've also tried Minto's solution of invalidating caches/restarting android studio ...my SDK is up to date as at the time of posting. Thanks for any help in advance

推荐答案

请确保您把下面进入您的应用程序的build.gradle文件,以提供必要的依赖:

Make sure that you put the following entry into your application's build.gradle file to provide the necessary dependencies:

dependencies {
    compile 'com.android.support:support-v4:20.0+'
}

版本号是很重要的,如果你指定一个旧版本,它会缺少新的通知code为身打扮。

The version number is important, if you specify an older version it will be missing the new Notification code for wearables.

这篇关于Android的工作室无法导入WearableExtender NotificationManagerCompat和RemoteInput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆