过去24小时我一直在尝试这个,但没有成功!我已按照InMobi支持中提到的每个步骤进行操作。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.abc.xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "2.01"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:multidex:1.0.1'
//InMobi
compile 'com.inmobi.monetization:inmobi-ads:5.3.1'
compile 'com.sothree.slidinguppanel:library:3.2.1'
//compile files('libs/InMobi-5.3.1.jar')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
apply plugin: 'com.google.gms.google-services'
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.xyz">
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission-sdk-23 android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission-sdk-23 android:name="com.example.googlemaps.permission.MAPS_RECEIVE" />
<uses-permission-sdk-23 android:name="android.permission.INTERNET" />
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission-sdk-23 android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission-sdk-23 android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission-sdk-23 android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission-sdk-23 android:name="android.permission.READ_CALENDAR"/>
<uses-permission-sdk-23 android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission-sdk-23 android:name="android.permission.VIBRATE"/>
<uses-permission-sdk-23 android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name=".MapConnection_Activity"
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:supportsRtl="true"
>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
<activity android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:hardwareAccelerated="true" />
<receiver
android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="com.inmobi.share.id" />
</intent-filter>
</receiver>
<service android:name="com.inmobi.signals.activityrecognition.ActivityRecognitionManager"
android:enabled="true" />
</application>
</manifest>
08-01 09:50:36.101 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.os.PowerManager.isDeviceIdleMode, referenced from method com.inmobi.commons.core.utilities.c.b
08-01 09:50:36.111 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.os.PowerManager.isDeviceIdleMode, referenced from method com.inmobi.commons.core.utilities.e$a.a
08-01 09:50:36.301 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.webkit.WebResourceError.getErrorCode, referenced from method com.inmobi.rendering.RenderView$5.onReceivedError
08-01 09:50:36.351 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.createCalendarEvent
08-01 09:50:36.361 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.getGalleryImage
08-01 09:50:36.371 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.registerMicListener
08-01 09:50:36.371 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.storePicture
08-01 09:50:36.371 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.takeCameraPicture
08-01 09:50:36.381 26031-26031/com.abc.xyz I/dalvikvm: Could not find method android.content.Context.checkSelfPermission, referenced from method com.inmobi.rendering.a.unregisterMicListener
mMessage = The InMobi SDK encountered an internal error.
mStatusCode = INTERNAL_ERROR
我的代码中唯一不同的是com.google.android.gms:play-services:9.2.1
而不是com.google.android.gms:play-services:8.1.0
根据其支持网站,因为apply plugin: 'com.google.gms.google-services'
迫使我使用9.0以上的版本,我添加了因为我使用的是google-services.json
文件,即使是InMobi要求的文件。
另外,我从网站上尝试了他们的示例应用程序,它也给出了相同的错误。另外,如果重要的话,我在Debian上使用Android Studio 2.1.2
。任何帮助都是最受欢迎的!