A
AlexxxBcN
Gamma
Verificado por Whatsapp
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola , antiguamente usaba Eclipse , y estos dias compile una App con Android Studio , despues de 3 dias , no consigo que se me vea el banner , pero si el espacio.
Estoy compilando con API 27:
No sé donde tengo el error , dejo todo donde tengo puesto código sobré el problema , si alguien ve el error o posible error , le estaré agradecido
PD: SOLUCIONADO !!! , El problema era con las id que me da admob , una con / y otra con ~
asi llevaba desde el viernes hasta hoy martes a la mañana ... y era una tonteria que se pudo solucionar el mismo viernes .. lo positivo de esto , que este fallo me hizo aprender cosas jeje
Ahora estoy en el proceso de firmar la App , tanto en relase o debug , al instalarla en el movil me sale un mensaje: RAZON :confusion: oTROS
Luego seguire investigando , alguien tiene INFO al respecto ?
PD: SOLUCIONADO !!! , Solo con eliminar la app instalada en el móvil se soluciona , luego ya deja instalar.
,
AndroidManifest
MainActivity
Layout - activity_Main
Strings
Build.Gradle - Project
Build.Gradle - Module
Estoy compilando con API 27:
No sé donde tengo el error , dejo todo donde tengo puesto código sobré el problema , si alguien ve el error o posible error , le estaré agradecido
PD: SOLUCIONADO !!! , El problema era con las id que me da admob , una con / y otra con ~
asi llevaba desde el viernes hasta hoy martes a la mañana ... y era una tonteria que se pudo solucionar el mismo viernes .. lo positivo de esto , que este fallo me hizo aprender cosas jeje
Ahora estoy en el proceso de firmar la App , tanto en relase o debug , al instalarla en el movil me sale un mensaje: RAZON :confusion: oTROS
Luego seguire investigando , alguien tiene INFO al respecto ?
PD: SOLUCIONADO !!! , Solo con eliminar la app instalada en el móvil se soluciona , luego ya deja instalar.
,
AndroidManifest
Insertar CODE, HTML o PHP:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ap.app">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
[B]<!--This meta-data tag is required to use Google Play Services.-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />[/B]
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
[B]<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />[/B]
</application>
</manifest>
MainActivity
Insertar CODE, HTML o PHP:
[B]
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.AdView;[/B]
[MENTION=42437]over[/MENTION]ride
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
[B] //Add this in OnCreate of Activity to initialize the ad
MobileAds.initialize(getApplicationContext(), "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx");
// Create a banner ad
AdView mAdView = new AdView(this);
mAdView.setAdSize(AdSize.BANNER);
mAdView.setAdUnitId("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx");
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);[/B]
WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.loadUrl("file:///android_asset/index.html");
myWebView.setWebViewClient(new MyWebViewClient());
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
Layout - activity_Main
Insertar CODE, HTML o PHP:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
[B]<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx">
</com.google.android.gms.ads.AdView>
[/B]
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="@id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/myWebView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<ProgressBar
android:id="@+id/simpleProgressBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
android:layout_marginTop="1dp"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:progressDrawable="@drawable/custom_progress"/>
</RelativeLayout>
Strings
Insertar CODE, HTML o PHP:
<resources>
<string name="banner_ad_unit_id">ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx</string>
</resources>
Build.Gradle - Project
Insertar CODE, HTML o PHP:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Build.Gradle - Module
Insertar CODE, HTML o PHP:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.ap.app"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "3.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
[B]
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.android.gms:play-services-ads:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
[/B]
Última edición: