我刚刚安装了新的Android Studio,我正在寻找一种方法来导入Android的支持库.
那个选项在哪里?在Eclipse中只需两次点击.我用谷歌搜索但没有发现任何东西.当然它太新了.
我想在我的Android应用程序中添加外部库https://github.com/foursquare/foursquare-android-oauth(我使用Android Studio,lib作者为Eclipse提供的说明不适用于Android Studio).
我已经尝试用maven做了,所以在File-> Project Structure-> Dependencies中我添加com.foursquare:foursquare-android-nativeoauth-lib:1.0.0但是Gradle Sync失败了:
Error:Failed to find: com.foursquare:foursquare-android-nativeoauth-lib:1.0.0
Run Code Online (Sandbox Code Playgroud)
当我尝试构建我的应用程序(没有修复上面的错误,因为我不知道如何)我得到:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.foursquare:foursquare-android-nativeoauth-lib:1.0.0.
Required by:
ForSquaresOnly:app:unspecified
> Could not parse POM http://jcenter.bintray.com/com/foursquare/foursquare-android-nativeoauth-lib/1.0.0/foursquare-android-nativeoauth-lib-1.0.0.pom
> Could not find any version that matches com.foursquare:parent:1.0.0.
Run Code Online (Sandbox Code Playgroud)
有没有其他方法可以导入这个lib?我可以简单地将源代码复制粘贴到我的源代码中或从中创建JAR吗?
顺便说一句:如果遇到问题,请看这个问题(导入后我遇到了这个问题):清单合并失败:使用-sdk:minSdkVersion 14
我是Android开发的新手,我想首先让Hello World应用程序运行.我正在使用Eclipse IDE和Android 4.0.3版本15 SDK.我从教程站点复制了所有内容,但是当我尝试运行应用程序时,virtual device我收到此错误:
[2012-02-01 11:31:23 - Android_test] Installation error: INSTALL_FAILED_OLDER_SDK
[2012-02-01 11:31:23 - Android_test] Please check logcat output for more details.
[2012-02-01 11:31:23 - Android_test] Launch canceled!
Run Code Online (Sandbox Code Playgroud)
这是我的com.maze.app包中的类:package com.maze.app;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
Run Code Online (Sandbox Code Playgroud)
和AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maze.app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" …Run Code Online (Sandbox Code Playgroud) 问题是..
Error:Execution failed for task ':app:processDebugManifest'.
Run Code Online (Sandbox Code Playgroud)
清单合并失败:uses-sdk:minSdkVersion 8不能小于库com.android.support:support-v4:21.0.0-rc1中声明的版本L.
build.gradle中的代码
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.androidexample.gcm"
minSdkVersion 8
targetSdkVersion 16
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:+'
//compile 'com.android.support:support-v4:20.0.0'
//compile 'com.google.android.gms:play-services:5.0.77'
}
Run Code Online (Sandbox Code Playgroud)
AndroidManifest中的代码是..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidexample.gcm"
android:versionCode="1"
android:versionName="1.0" >
<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<!-- Main activity. …Run Code Online (Sandbox Code Playgroud) 我在支持库中找不到RecyclerView,Palette或CardView.仿真器以"未找到类"错误响应.
我该如何修复这样的错误?
我已经开发了这个小项目好几天了但是今天突然间,Android Studio开始给我这个错误
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 14 declared in library com.android.support:support-v4:21.0.0-rc1
Run Code Online (Sandbox Code Playgroud)
我明白这是因为它正在尝试编译Android-L库.我想要它编译的版本是旧版本,但它不会.无论我输入哪个版本,它都会一直给我上述错误.这是依赖项.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
Run Code Online (Sandbox Code Playgroud)
UPDATE
我刚刚安装了Android Studio Beta并将我的依赖项更改为下面的Eugen建议.但是,无论我指定哪个版本的appcompat支持版本,同步项目都会产生相同的错误.它每次同步时都会出现此错误
uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
Run Code Online (Sandbox Code Playgroud)
我更新的依赖项
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
}
Run Code Online (Sandbox Code Playgroud)
更新2
我认为我没有正确理解Android Studio的依赖系统.我刚从依赖项中删除了appcompat和support,它仍然给了我同样的错误.我是否必须从某处删除最初包含的库?
的build.gradle
*注意 - 我再次添加了这两个库并尝试同步,以防万一.但没有变化.
apply plugin: 'android'
android {
compileSdkVersion 19 …Run Code Online (Sandbox Code Playgroud) android gradle android-studio build.gradle android-gradle-plugin
在我的项目minSdkVersion = 10中,在库中它是11.
我明白了:
BUILD_FAILED - Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 11 declared in library.
Run Code Online (Sandbox Code Playgroud)
如何忽略库的minSdkVersion?
android android-studio android-gradle-plugin android-min-sdk
我正在尝试使用Android Studio 0.8.0测试版和最新工具运行项目,它需要API 20,因此无法在使用API 19的设备上运行
有任何想法吗?
从http://developer.android.com/training/implementing-navigation/nav-drawer.html导入演示后,android studio会自动进行Gradle配置.首先,它的依赖部分在build.gradle:
dependencies {
compile 'com.android.support:+'
}
Run Code Online (Sandbox Code Playgroud)
而上述原因导致错误.
遵循解决方案(Manifest merger failed:uses-sdk:minSdkVersion 14),我将其更改为
dependencies {
compile 'com.android.support:support-v4:20.0.0'
}
Run Code Online (Sandbox Code Playgroud)
它的工作原理.然后我可以构建并运行该应用程序.
但是,代码显示'无法解析符号R','无法解析符号DrawerLayout'等.然后我发现错误activity_main.xml:
android.support.v4.widget.DrawerLayout could not be found
Run Code Online (Sandbox Code Playgroud)
我已经指定了依赖关系android.support.v4,以及为什么找不到drawerlayout?
我只是迁移到Android Studio,我对如何管理我的项目/模块感到有点困惑.
例如,在Eclipse中我将有3个项目:
所以如果我理解正确的话,我会在Android Studio中创建2个项目,一个用于AP1,一个用于AP2,在这两个项目中我会将Library项目添加为模块?
当我这样做时,我突然Facets在图书馆模块中得到两个叫做Android和Android2.这是什么意思?
另外,如果我去一个远一点,并添加多个库,模块,我得到(下项目设置中的库选项卡)多个库,libs,libs1,libs2.这些可能包含双罐,AS抱怨.
如果有人能清除一些东西,那就太好了.谢谢!
我正在使用专为 Android SDK 16 设计的Uber SDK。我目前的 minSdkVersion 是 14。我可以像这样使用它 -
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
//Call specific function
}
Run Code Online (Sandbox Code Playgroud)
并将 xml 放在文件夹中layout-v16。但清单合并失败
uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
android android-manifest android-studio android-4.1-jelly-bean
我有一些常见的错误,比如尝试设置fb sdk,例如ANDROID_BUILD_SDK_TOOLS ERROR和getbootclasspath()方法错误
但人们在SO上发布的一些解决方案的最小sdk为14,而不是9(在fb的指南中显示).现在在我的应用程序的build.gradle文件中,如果我使用minSdkVersion 9而不是14,它将不会工作,它会说:
任务':app:processDebugManifest'的执行失败.
清单合并失败:uses-sdk:minSdkVersion 9不能小于库中声明的版本14
我已经研究过,但找不到使用9的解决方案,因为我想在Gingerbread上支持应用程序.