我似乎无法在Androoid Studio中编译我的应用程序,我正在尝试使用Android Youtube Player API。我在我的libs文件夹中包含了AndroidYoutubePlayerApi.jar:
这就是我所做的:
build.gardle(模块:应用程序)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.xxx.xxx.xxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.google.apis:google-api-services-youtube:v3-rev125-1.19.1'
}
在AndroidManifest.xml中添加了用户权限:
<uses-permission android:name="android.permission.INTERNET" />
但似乎无法编译和导入com.google.android。*;
我已经下载了所有SDK工具aswel。
更新
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
}
答案 0 :(得分:2)
我知道这是一个老问题,但是在此错误消息中,它在Google上的得分很高,所以我想在这里提供解决方案。
我正在使用Android Studio构建一个使用YouTube播放器(通过cordova-plugin-youtube-video-player的方式)的Ionic应用。这可能与其他人尝试做的事情并不相同,但是此解决方案可能会将他们指向正确的方向。
我转到“文件>项目结构...”
在左侧面板中,有一个列表。 “模块”下是我正在构建的项目的名称(“应用”)。
点击“应用”,然后点击依赖项标签,我手动为 YouTubeAndoridPlayerApi.jar 和 openyoutubeactivity.jar 添加依赖项,作为“实现”依赖项。< / p>
为什么不确定“ libs”目录中的“ * .jar”包含不执行该包含,所以我不确定。但是当我显式添加依赖项时,我的项目就可以成功编译。