mopub android studio millennialmedia 未解决
mopub android studio millennialmedia unresolved
我正在尝试添加 MoPub 添加,我使用 Android Studio。我尝试在此处应用说明:
https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started
标题后我无法应用它们 "Adding as Compiled .aar" 我猜。
项目中一切似乎都很好,但我在文件夹 mop-sdk/java/mobileads/util[=14 中的文件 "MillennialInterstitial" "MillennialBanner" 中得到了未使用的导入和符号无法解决的错误=]
我尝试手动导入 millennial media 的 jar,我从这里注册并下载了资源:
http://docs.millennialmedia.com/android-SDK/
非常感谢
我想我也没能成功。这是我的错误的副本,如果它有任何帮助的话。
Error:(7, 35) error: package com.millennialmedia.android does not exist
Error:(8, 35) error: package com.millennialmedia.android does not exist
Error:(9, 35) error: package com.millennialmedia.android does not exist
Error:(10, 35) error: package com.millennialmedia.android does not exist
Error:(11, 35) error: package com.millennialmedia.android does not exist
Error:(12, 35) error: package com.millennialmedia.android does not exist
Error:(23, 13) error: cannot find symbol class MMAdView
Error:(122, 5) error: cannot find symbol class MMAdView
Error:(87, 54) error: cannot find symbol class RequestListener
Error:(89, 47) error: cannot find symbol class MMAd
Error:(95, 45) error: cannot find symbol class MMAd
Error:(101, 48) error: cannot find symbol class MMAd
Error:(104, 44) error: cannot find symbol class MMAd
Error:(110, 41) error: cannot find symbol class MMAd
Error:(110, 58) error: cannot find symbol class MMException
Error:(116, 39) error: cannot find symbol class MMAd
Error:(47, 9) error: cannot find symbol variable MMSDK
Error:(49, 33) error: cannot find symbol class MMAdView
Error:(58, 13) error: cannot find symbol variable MMRequest
Error:(61, 44) error: cannot find symbol class MMRequest
Error:(62, 33) error: cannot find symbol variable MMSDK
Error:(88, 9) error: method does not override or implement a method from a supertype
Error:(94, 9) error: method does not override or implement a method from a supertype
Error:(100, 9) error: method does not override or implement a method from a supertype
Error:(103, 9) error: method does not override or implement a method from a supertype
Error:(109, 9) error: method does not override or implement a method from a supertype
Error:(115, 9) error: method does not override or implement a method from a supertype
/Users/ugur/AndroidStudioProjects/xxx/mopub-sdk/src/main/java/com/mopub/mobileads/MillennialInterstitial.java
Error:(7, 35) error: package com.millennialmedia.android does not exist
Error:(8, 35) error: package com.millennialmedia.android does not exist
Error:(9, 35) error: package com.millennialmedia.android does not exist
Error:(10, 35) error: package com.millennialmedia.android does not exist
Error:(11, 35) error: package com.millennialmedia.android does not exist
Error:(12, 35) error: package com.millennialmedia.android does not exist
Error:(24, 13) error: cannot find symbol class MMInterstitial
Error:(77, 60) error: cannot find symbol class RequestListener
Error:(79, 47) error: cannot find symbol class MMAd
Error:(85, 45) error: cannot find symbol class MMAd
Error:(90, 58) error: cannot find symbol class MMAd
Error:(93, 44) error: cannot find symbol class MMAd
Error:(104, 41) error: cannot find symbol class MMAd
Error:(104, 58) error: cannot find symbol class MMException
Error:(118, 39) error: cannot find symbol class MMAd
Error:(41, 9) error: cannot find symbol variable MMSDK
Error:(45, 13) error: cannot find symbol variable MMRequest
Error:(48, 39) error: cannot find symbol class MMInterstitial
Error:(50, 50) error: cannot find symbol class MMRequest
Error:(78, 9) error: method does not override or implement a method from a supertype
Error:(84, 9) error: method does not override or implement a method from a supertype
Error:(90, 9) error: method does not override or implement a method from a supertype
Error:(92, 9) error: method does not override or implement a method from a supertype
Error:(103, 9) error: method does not override or implement a method from a supertype
Error:(107, 39) error: cannot find symbol variable MMException
Error:(117, 9) error: method does not override or implement a method from a supertype
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Error:Execution failed for task ':mopub-sdk:compileReleaseJava'.
> Compilation failed; see the compiler error output for details.
我发现问题了:
我使用的是 MoPub 的 "Full SDK",但实际上并不需要。当我再次在此 link 中使用 "Base SDK" 时:
https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started
执行此 post
中的步骤后一切顺利
Android Studio won't let me import SDK
我希望我能拯救另一个人一个周末:)
我刚刚找到了一个更好的解决方案:
由于无法识别导入,这意味着 class 无法访问项目的库。所以我添加了
compile fileTree(dir: 'libs', include: ['*.jar'])
在 mopub-sdk build.gradle 的依赖会话中。
下面我展示了整个gradle以供参考
// This buildscript will assemble the MoPub SDK into an AAR.
repositories {
jcenter()
}
apply plugin: 'com.android.library'
group = 'com.mopub'
description = '''MoPub SDK'''
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
versionCode 24
versionName "3.7.0"
minSdkVersion 9
targetSdkVersion 22
consumerProguardFiles 'proguard.txt'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main']
renderscript.srcDirs = ['src/main']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt')
}
}
// Note: You will also need a local.properties file to set the location of the SDK in the same
// way that the existing SDK requires, using the sdk.dir property.
// Alternatively, you can set an environment variable called ANDROID_HOME. There is no
// difference between the two methods, you can use the one you prefer.
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.mopub.volley:mopub-volley:1.1.0'
}
// Don't run the Robolectric Unit Tests.
check.dependsOn.remove("test")
check.dependsOn.remove("unitTest")
check.dependsOn.remove("testDebug")
check.dependsOn.remove("unitTestDebug")
我正在尝试添加 MoPub 添加,我使用 Android Studio。我尝试在此处应用说明:
https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started
标题后我无法应用它们 "Adding as Compiled .aar" 我猜。
项目中一切似乎都很好,但我在文件夹 mop-sdk/java/mobileads/util[=14 中的文件 "MillennialInterstitial" "MillennialBanner" 中得到了未使用的导入和符号无法解决的错误=]
我尝试手动导入 millennial media 的 jar,我从这里注册并下载了资源:
http://docs.millennialmedia.com/android-SDK/
非常感谢
我想我也没能成功。这是我的错误的副本,如果它有任何帮助的话。
Error:(7, 35) error: package com.millennialmedia.android does not exist
Error:(8, 35) error: package com.millennialmedia.android does not exist
Error:(9, 35) error: package com.millennialmedia.android does not exist
Error:(10, 35) error: package com.millennialmedia.android does not exist
Error:(11, 35) error: package com.millennialmedia.android does not exist
Error:(12, 35) error: package com.millennialmedia.android does not exist
Error:(23, 13) error: cannot find symbol class MMAdView
Error:(122, 5) error: cannot find symbol class MMAdView
Error:(87, 54) error: cannot find symbol class RequestListener
Error:(89, 47) error: cannot find symbol class MMAd
Error:(95, 45) error: cannot find symbol class MMAd
Error:(101, 48) error: cannot find symbol class MMAd
Error:(104, 44) error: cannot find symbol class MMAd
Error:(110, 41) error: cannot find symbol class MMAd
Error:(110, 58) error: cannot find symbol class MMException
Error:(116, 39) error: cannot find symbol class MMAd
Error:(47, 9) error: cannot find symbol variable MMSDK
Error:(49, 33) error: cannot find symbol class MMAdView
Error:(58, 13) error: cannot find symbol variable MMRequest
Error:(61, 44) error: cannot find symbol class MMRequest
Error:(62, 33) error: cannot find symbol variable MMSDK
Error:(88, 9) error: method does not override or implement a method from a supertype
Error:(94, 9) error: method does not override or implement a method from a supertype
Error:(100, 9) error: method does not override or implement a method from a supertype
Error:(103, 9) error: method does not override or implement a method from a supertype
Error:(109, 9) error: method does not override or implement a method from a supertype
Error:(115, 9) error: method does not override or implement a method from a supertype
/Users/ugur/AndroidStudioProjects/xxx/mopub-sdk/src/main/java/com/mopub/mobileads/MillennialInterstitial.java
Error:(7, 35) error: package com.millennialmedia.android does not exist
Error:(8, 35) error: package com.millennialmedia.android does not exist
Error:(9, 35) error: package com.millennialmedia.android does not exist
Error:(10, 35) error: package com.millennialmedia.android does not exist
Error:(11, 35) error: package com.millennialmedia.android does not exist
Error:(12, 35) error: package com.millennialmedia.android does not exist
Error:(24, 13) error: cannot find symbol class MMInterstitial
Error:(77, 60) error: cannot find symbol class RequestListener
Error:(79, 47) error: cannot find symbol class MMAd
Error:(85, 45) error: cannot find symbol class MMAd
Error:(90, 58) error: cannot find symbol class MMAd
Error:(93, 44) error: cannot find symbol class MMAd
Error:(104, 41) error: cannot find symbol class MMAd
Error:(104, 58) error: cannot find symbol class MMException
Error:(118, 39) error: cannot find symbol class MMAd
Error:(41, 9) error: cannot find symbol variable MMSDK
Error:(45, 13) error: cannot find symbol variable MMRequest
Error:(48, 39) error: cannot find symbol class MMInterstitial
Error:(50, 50) error: cannot find symbol class MMRequest
Error:(78, 9) error: method does not override or implement a method from a supertype
Error:(84, 9) error: method does not override or implement a method from a supertype
Error:(90, 9) error: method does not override or implement a method from a supertype
Error:(92, 9) error: method does not override or implement a method from a supertype
Error:(103, 9) error: method does not override or implement a method from a supertype
Error:(107, 39) error: cannot find symbol variable MMException
Error:(117, 9) error: method does not override or implement a method from a supertype
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Error:Execution failed for task ':mopub-sdk:compileReleaseJava'.
> Compilation failed; see the compiler error output for details.
我发现问题了:
我使用的是 MoPub 的 "Full SDK",但实际上并不需要。当我再次在此 link 中使用 "Base SDK" 时:
https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started
执行此 post
中的步骤后一切顺利Android Studio won't let me import SDK
我希望我能拯救另一个人一个周末:)
我刚刚找到了一个更好的解决方案: 由于无法识别导入,这意味着 class 无法访问项目的库。所以我添加了
compile fileTree(dir: 'libs', include: ['*.jar'])
在 mopub-sdk build.gradle 的依赖会话中。
下面我展示了整个gradle以供参考
// This buildscript will assemble the MoPub SDK into an AAR.
repositories {
jcenter()
}
apply plugin: 'com.android.library'
group = 'com.mopub'
description = '''MoPub SDK'''
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
versionCode 24
versionName "3.7.0"
minSdkVersion 9
targetSdkVersion 22
consumerProguardFiles 'proguard.txt'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main']
renderscript.srcDirs = ['src/main']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt')
}
}
// Note: You will also need a local.properties file to set the location of the SDK in the same
// way that the existing SDK requires, using the sdk.dir property.
// Alternatively, you can set an environment variable called ANDROID_HOME. There is no
// difference between the two methods, you can use the one you prefer.
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.mopub.volley:mopub-volley:1.1.0'
}
// Don't run the Robolectric Unit Tests.
check.dependsOn.remove("test")
check.dependsOn.remove("unitTest")
check.dependsOn.remove("testDebug")
check.dependsOn.remove("unitTestDebug")