Ich habe Voraussetzung "Google Play Service" in SDK Manager Extras installiert. Wenn sie ausgeführt wird, wird die App-Seite im Emulator ohne Banner angezeigt, und das CLI-Protokoll zeigt einen Fehler an. Kann mir irgendjemand sagen, was ich vermisse?Kann Nativescript-Plugin zu arbeiten "nativescript-admob"
admob.createBanner({
// if this 'view' property is not set, the banner is overlayed on the current top most view
// view: ..,
testing: true, // set to false to get real banners
size: admob.AD_SIZE.SMART_BANNER, // anything in admob.AD_SIZE, like admob.AD_SIZE.SMART_BANNER
iosBannerId: "ca-app-pub-XXXXXX/YYYYYY", // add your own
androidBannerId: "ca-app-pub-9495738740700511/5085446949", // add your own
// Android automatically adds the connected device as test device with testing:true, iOS does not
iosTestDeviceIds: ["yourTestDeviceUDIDs", "EAA5B49DBA3AD30CC27A343C86CD7ADF"],
margins: {
// if both are set, top wins
//top: 10
bottom: 50
}
}).then(
function() {
console.log("admob createBanner done");
},
function(error) {
console.log("admob createBanner error: " + error);
}
)
- ich geschaffen habe neue Projekt "tns erstellen adtest"
- Plugin
- hinzugefügt Plattform "tns Plattform hinzufügen android"
- läuft von „tns "tns nativescript-admob hinzufügen Plugin" LiveSync android --watch“
--- ERROR LOG ---
Project successfully prepared
The application with id "org.nativescript.adtest" is not installed on device with identifier emulator-5554.
Project successfully prepared
WARNING: The file: D:\GoogleDrive\PROJECTS\adtest\node_modules\nativescript-admob\platforms\android\AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
:config phase: createDefaultIncludeFiles
+found plugins: nativescript-admob
{
"F0" {
dimension "nativescriptadmob"
}
}
} +found plugins: tns-core-modules-widgets
{
"F1" {
dimension "tnscoremoduleswidgets"
}
}
}
:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in D:\GoogleDrive\PROJECTS\adtest\platforms\android/configurations folder...
:config phase: pluginExtend
+applying configuration from: D:\GoogleDrive\PROJECTS\adtest\platforms\android\configurations\include.gradle
+applying configuration from: D:\GoogleDrive\PROJECTS\adtest\platforms\android\configurations\nativescript-admob\include.gradle
+applying configuration from: D:\GoogleDrive\PROJECTS\adtest\platforms\android\configurations\tns-core-modules-widgets\include.gradle
:config phase: copyAarDependencies
:config phase: addAarDependencies
+adding dependency: D:\GoogleDrive\PROJECTS\adtest\platforms\android\libs\aar\widgets-release.aar
:preBuild UP-TO-DATE
:preF0F1DebugBuild UP-TO-DATE
:checkF0F1DebugManifest
:preF0F1ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2330Library
:prepareComAndroidSupportAppcompatV72330Library
:prepareComAndroidSupportSupportV42330Library
:prepareComAndroidSupportSupportVectorDrawable2330Library
:prepareComGoogleAndroidGmsPlayServicesAds840Library
:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:prepareWidgetsReleaseLibrary
:prepareF0F1DebugDependencies
:compileF0F1DebugAidl UP-TO-DATE
:compileF0F1DebugRenderscript UP-TO-DATE
:generateF0F1DebugBuildConfig UP-TO-DATE
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE
:generateF0F1DebugAssets UP-TO-DATE
:mergeF0F1DebugAssets
:generateF0F1DebugResValues UP-TO-DATE
:generateF0F1DebugResources UP-TO-DATE
:mergeF0F1DebugResources UP-TO-DATE
:processF0F1DebugManifest UP-TO-DATE
:processF0F1DebugResources
:generateF0F1DebugSources
:compileF0F1DebugJavaWithJavac UP-TO-DATE
:compileF0F1DebugNdk UP-TO-DATE
:compileF0F1DebugSources UP-TO-DATE
:buildMetadata UP-TO-DATE
:transformClassesWithDexForF0F1Debug UP-TO-DATE
:mergeF0F1DebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForF0F1Debug UP-TO-DATE
:processF0F1DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForF0F1Debug UP-TO-DATE
:validateDebugSigning
:packageF0F1Debug
:zipalignF0F1Debug
:assembleF0F1Debug
:assembleDebug
:deleteExplodedAarFolder UP-TO-DATE
:buildapk
BUILD SUCCESSFUL
Total time: 11.657 secs
Project successfully built
JS: Treating this deviceId as testdevice: CA5F7DA5D57FD0D05E676D0CD880FB80
chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
05-06 03:27:04.304 3124 3124 I BrowserStartupController: Initializing chromium process, singleProcess=true
chromium: [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
05-06 03:27:04.349 3124 3124 E DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
JS: Error in admob.createBanner: TypeError: Cannot read property 'android' of null
JS: admob createBanner error: TypeError: Cannot read property 'android' of null
chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
chromium: [INFO:CONSOLE(0)] "Creating Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Downloading event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Progress event (0 of 4) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.js", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Progress event (1 of 4) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.js", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Progress event (2 of 4) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/canary/sdk-core-v40-impl.js", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Progress event (3 of 4) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.js", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
Das stimmt, vielleicht zu früh. Ich habe es in Seite navigatingTo Funktion platziert und möglicherweise nicht genug Zeit, um zu initialisieren. Wenn ich es in TAP-Taste verschiebe, funktioniert es einfach auf Klick. Aber mein Problem ist jetzt, ich möchte es laden, wenn die Seite startet. Hat Nativescript etwas wie seitenweise geladen oder was ist der beste Weg, es zu positionieren? – user2224893
Natürlich. Überprüfen Sie einfach ihre Dokumentation https://docs.nativescript.org/. Schneller als auf SO veröffentlichen;) – Miro