Failed to resolve: recyclerview-v7

Failed to resolve: recyclerview-v7
https://stackoverflow.com/questions/50891617/failed-to-resolve-recyclerview-v7

3
down vote
favorite
While adding dependency implementation ‘com.azoft.carousellayoutmanager:carousel:1.2.4’ to my project, Android Studio throws exception Failed to resolve: recyclerview-v7. Then I tried adding dependency for recyclerview. Still getting same error.

apply plugin: ‘com.android.application’

android {
compileSdkVersion 27
defaultConfig {
applicationId “com.someapp”
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName “1.0”

vectorDrawables.useSupportLibrary = true

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
}
}

dependencies {
implementation fileTree(include: [‘*.jar’], dir: ‘libs’)
implementation ‘com.android.support:appcompat-v7:27.1.1’
implementation ‘com.android.support.constraint:constraint-layout:1.1.2’
implementation ‘com.google.firebase:firebase-crash:16.0.1’
implementation ‘com.android.support:design:27.1.1’
implementation ‘com.squareup.retrofit2:retrofit:2.1.0’
implementation ‘com.squareup.retrofit2:converter-gson:2.1.0’
implementation ‘com.squareup.okhttp3:logging-interceptor:3.3.1’
implementation ‘com.commonsware.cwac:saferoom:0.4.1’
implementation ‘com.squareup.picasso:picasso:2.5.2’
implementation ‘com.android.support:cardview-v7:27.1.1’
}

apply plugin: ‘com.google.gms.google-services’
android android-studio android-recyclerview android-gradle
shareimprove this question
asked Jun 16 at 20:46

Suresh Kumar
1,0931821
can you post the log cat error message – Frank Odoom Jun 16 at 20:52
I get only this Failed to resolve: recyclerview-v7 in gradle log. – Suresh Kumar Jun 16 at 20:53
add a comment
6 Answers
active oldest votes
up vote
2
down vote
I have same problem and i change order of repositories in biuld.gradle (app) and problem solved.

Change :

jcenter()
google()
To :

google()
jcenter()
shareimprove this answer
answered Aug 25 at 7:46

Radesh
1,206520
add a comment

发布了111 篇原创文章 · 获赞 75 · 访问量 48万+
展开阅读全文

提示cannot resolve symbol 'NonNull'

04-06

# 从网上下下来一个Demo 然后自己在学习的过程中,在demo基础上修修改改,之前能打开,今天编译0错误0警告,能启动虚拟机,但是应用就是跑 不起来,显示已经停止,发现错误好像都在这个叫Hyphenator.java的类中, ## import android.annotation.NonNull;提示cannot resolve symbol 'NonNull' ## import com.android.internal.annotations.GuardedBy;提示connot resolve symbol 'GuardedBy' ``` package android.text; import android.annotation.NonNull; import android.util.Log; import com.android.internal.annotations.GuardedBy; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.HashMap; import java.util.Locale; /** * Hyphenator is a wrapper class for a native implementation of automatic hyphenation, * in essence finding valid hyphenation opportunities in a word. * * @hide */ public class Hyphenator { // This class has deliberately simple lifetime management (no finalizer) because in // the common case a process will use a very small number of locales. private static String TAG = "Hyphenator"; private final static Object sLock = new Object(); @GuardedBy("sLock") final static HashMap<Locale, Hyphenator> sMap = new HashMap<Locale, Hyphenator>(); final static Hyphenator sEmptyHyphenator = new Hyphenator(StaticLayout.nLoadHyphenator(null, 0), null); final private long mNativePtr; // We retain a reference to the buffer to keep the memory mapping valid @SuppressWarnings("unused") final private ByteBuffer mBuffer; private Hyphenator(long nativePtr, ByteBuffer b) { mNativePtr = nativePtr; mBuffer = b; } public long getNativePtr() { return mNativePtr; } public static Hyphenator get(@Nullable Locale locale) { synchronized (sLock) { Hyphenator result = sMap.get(locale); if (result != null) { return result; } // If there's a variant, fall back to language+variant only, if available final String variant = locale.getVariant(); if (!variant.isEmpty()) { final Locale languageAndVariantOnlyLocale = new Locale(locale.getLanguage(), "", variant); result = sMap.get(languageAndVariantOnlyLocale); if (result != null) { sMap.put(locale, result); return result; } } // Fall back to language-only, if available final Locale languageOnlyLocale = new Locale(locale.getLanguage()); result = sMap.get(languageOnlyLocale); if (result != null) { sMap.put(locale, result); return result; } // Fall back to script-only, if available final String script = locale.getScript(); if (!script.equals("")) { final Locale scriptOnlyLocale = new Locale.Builder() .setLanguage("und") .setScript(script) .build(); result = sMap.get(scriptOnlyLocale); if (result != null) { sMap.put(locale, result); return result; } } sMap.put(locale, sEmptyHyphenator); // To remember we found nothing. } return sEmptyHyphenator; } private static Hyphenator loadHyphenator(String languageTag) { String patternFilename = "hyph-" + languageTag.toLowerCase(Locale.US) + ".hyb"; File patternFile = new File(getSystemHyphenatorLocation(), patternFilename); try { RandomAccessFile f = new RandomAccessFile(patternFile, "r"); try { FileChannel fc = f.getChannel(); MappedByteBuffer buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); long nativePtr = StaticLayout.nLoadHyphenator(buf, 0); return new Hyphenator(nativePtr, buf); } finally { f.close(); } } catch (IOException e) { Log.e(TAG, "error loading hyphenation " + patternFile, e); return null; } } private static File getSystemHyphenatorLocation() { return new File("/system/usr/hyphen-data"); } // This array holds pairs of language tags that are used to prefill the map from locale to // hyphenation data: The hyphenation data for the first field will be prefilled from the // hyphenation data for the second field. // // The aliases that are computable by the get() method above are not included. private static final String[][] LOCALE_FALLBACK_DATA = { // English locales that fall back to en-US. The data is // from CLDR. It's all English locales, minus the locales whose // parent is en-001 (from supplementalData.xml, under <parentLocales>). // TODO: Figure out how to get this from ICU. {"en-AS", "en-US"}, // English (American Samoa) {"en-GU", "en-US"}, // English (Guam) {"en-MH", "en-US"}, // English (Marshall Islands) {"en-MP", "en-US"}, // English (Northern Mariana Islands) {"en-PR", "en-US"}, // English (Puerto Rico) {"en-UM", "en-US"}, // English (United States Minor Outlying Islands) {"en-VI", "en-US"}, // English (Virgin Islands) // All English locales other than those falling back to en-US are mapped to en-GB. {"en", "en-GB"}, // For German, we're assuming the 1996 (and later) orthography by default. {"de", "de-1996"}, // Liechtenstein uses the Swiss hyphenation rules for the 1901 orthography. {"de-LI-1901", "de-CH-1901"}, // Norwegian is very probably Norwegian Bokmål. {"no", "nb"}, // Use mn-Cyrl. According to CLDR's likelySubtags.xml, mn is most likely to be mn-Cyrl. {"mn", "mn-Cyrl"}, // Mongolian // Fall back to Ethiopic script for languages likely to be written in Ethiopic. // Data is from CLDR's likelySubtags.xml. // TODO: Convert this to a mechanism using ICU4J's ULocale#addLikelySubtags(). {"am", "und-Ethi"}, // Amharic {"byn", "und-Ethi"}, // Blin {"gez", "und-Ethi"}, // Geʻez {"ti", "und-Ethi"}, // Tigrinya {"wal", "und-Ethi"}, // Wolaytta }; /** * Load hyphenation patterns at initialization time. We want to have patterns * for all locales loaded and ready to use so we don't have to do any file IO * on the UI thread when drawing text in different locales. * * @hide */ public static void init() { sMap.put(null, null); // TODO: replace this with a discovery-based method that looks into /system/usr/hyphen-data String[] availableLanguages = { "as", "bn", "cy", "da", "de-1901", "de-1996", "de-CH-1901", "en-GB", "en-US", "es", "et", "eu", "fr", "ga", "gu", "hi", "hr", "hu", "hy", "kn", "ml", "mn-Cyrl", "mr", "nb", "nn", "or", "pa", "pt", "sl", "ta", "te", "tk", "und-Ethi", }; for (int i = 0; i < availableLanguages.length; i++) { String languageTag = availableLanguages[i]; Hyphenator h = loadHyphenator(languageTag); if (h != null) { sMap.put(Locale.forLanguageTag(languageTag), h); } } for (int i = 0; i < LOCALE_FALLBACK_DATA.length; i++) { String language = LOCALE_FALLBACK_DATA[i][0]; String fallback = LOCALE_FALLBACK_DATA[i][1]; sMap.put(Locale.forLanguageTag(language), sMap.get(Locale.forLanguageTag(fallback))); } } } ``` ## ## 这个是我build.gradle文件 ``` apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion '25.0.0' defaultConfig { applicationId "cn.leancloud.leanstoragegettingstarted" minSdkVersion 14 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } //为了解决部分第三方库重复打包了META-INF的问题 packagingOptions{ exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.android.support:design:24.0.0' // LeanCloud 基础包 compile 'cn.leancloud.android:avoscloud-sdk:v3.+' compile 'cn.leancloud.android:avoscloud-statistics:v3.+' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.android.support:recyclerview-v7:24.0.0' compile 'com.android.support:cardview-v7:24.0.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support:support-v4:24.0.0-alpha1' compile 'com.android.support:support-annotations:24.0.0-alpha1' } ``` 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览