简体   繁体   English

为什么看不到android.support.v7文件?

[英]Why can't I see android.support.v7 files?

I'm trying to do the demo for the new Cast SDK (for using Chromecast), but I'm having trouble. 我正在尝试为新的Cast SDK(用于使用Chromecast)进行演示,但是遇到了麻烦。 I downloaded a demo for Android, and I'm getting errors in my project when trying to import anything from android.support.v7 library. 我下载了一个Android演示,尝试从android.support.v7库导入任何内容时,我的项目出现错误。

If I try to import from android.support.v4 or android.support.v13, things show up, but nothing shows up when I try to import from android.support.v7. 如果我尝试从android.support.v4或android.support.v13导入,则一切都会出现,但是当我尝试从android.support.v7导入时却什么也没有显示。 It seems as if I don't have these files, but when I open the Android SDK Manager, it seems that I have most things installed (Android 3.0 API 11 and above). 似乎我没有这些文件,但是当我打开Android SDK Manager时,似乎已安装了大多数东西(Android 3.0 API 11及更高版本)。

Does anyone know why I might be missing this, or how to get it up and running? 有谁知道为什么我可能会错过这个,或者如何启动和运行它?

Here are the files that I need to import for my demo: 这是我需要为演示导入的文件:

import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.MediaRouteActionProvider;
import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;

If you wants to integrate actionbar below android sdk 3.x use given link reference: Android Demo: http://developer.android.com/tools/support-library/features.html 如果您想在android sdk 3.x下集成动作栏,请使用给定的链接参考:Android演示: http : //developer.android.com/tools/support-library/features.html

"uses-sdk android:minSdkVersion="7" “ uses-sdk android:minSdkVersion =“ 7”

Support Library classes that provide support for android sdk 2.x and above. 支持库类提供对android sdk 2.x及更高版本的支持。

public class MainActivity extends ActionBarActivity { 公共类MainActivity扩展了ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    getSupportActionBar().setTitle("ActionBar Support Demo");
}

} }

http://www.coderzheaven.com/tag/android-support-v7-appcompat-jar/ http://www.coderzheaven.com/tag/android-support-v7-appcompat-jar/

There are multiple v7 libraries: appcompat, mediarouter and gridlayout. 有多个v7库:appcompat,mediarouter和gridlayout。 Follow the steps here to import and set them up (use Android Libraries with Resources); 请按照此处的步骤进行导入和设置(使用带有资源的Android库); you need to install appcompat first and then mediarouter and make sure the mediarouter library lists appcompat as part of its dependency. 您需要先安装appcompat,然后再安装mediarouter,并确保mediarouter库将appcompat列为其依赖项的一部分。

If you have already downloaded libraries, it will be present in android-sdk at following location. 如果您已经下载了库,它将在以下位置的android-sdk中出现。

android-sdk\\extras\\android\\support\\v7\\mediarouter\\libs\\android-support-v7-mediarouter.jar android-sdk \\ extras \\ android \\ support \\ v7 \\ mediarouter \\ libs \\ android-support-v7-mediarouter.jar

similarly include other jars as well from follwing folder. 同样包括以下文件夹中的其他罐子。

android-sdk\\extras\\android\\support\\v7 android-sdk \\ extras \\ android \\ support \\ v7

add these jars in your android project inside libs folder. 将这些jar添加到您的android项目的libs文件夹中。

I fixed the import of MediaRouter by adding this line into the dependencies inside the build.gradle file: 通过将以下行添加到build.gradle文件内的依赖项中,我修复了MediaRouter的导入:

compile 'com.android.support:mediarouter-v7:21.0.3'

Android Studio imports that as a library so there won't be any troubles with the resources at all. Android Studio将该库作为库导入,因此资源完全不会有任何麻烦。

You need to download and install Android Support Repository using the SDK Manager in Android Studio. 您需要使用Android Studio中的SDK Manager下载并安装Android支持存储库。 After that add the dependencies inside the build.gradle file as shown below 之后,将依赖项添加到build.gradle文件中,如下所示

dependencies {    
'compile com.android.support:mediarouter-v7:25.0.0'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM