I am developing a new release for my app with a test package name so i don't annoy current users.
Admob's native ads were showing but once i changed the app package name to the current P.N. that i use in Play Store , ads aren't showing any more and i get this error message :
the previous native ad failed to load. attempting to load another
PS : ads are not restricted for my app
PS 2 : admob is linked to my firebase account
My dependencies :
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.google.android.material:material:1.0.0' // Crash when updating
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
//implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.mikhaellopez:circularimageview:3.2.0' // circle image view
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "com.leinardi.android:speed-dial:2.0.1"
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.jsoup:jsoup:1.8.1'
implementation 'com.facebook.shimmer:shimmer:0.1.0#aar'
// Firebase login
implementation 'com.firebaseui:firebase-ui-auth:6.2.0'
implementation 'com.facebook.android:facebook-android-sdk:5.15.1'
implementation 'com.google.firebase:firebase-analytics:17.2.3' // Firebase Analytics
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta02'
// Add the Firebase SDK for Crashlytics.
//implementation 'com.google.firebase:firebase-perf:19.0.5' // Add the dependency for the Performance Monitoring library
implementation 'com.google.firebase:firebase-messaging:20.1.3' // Other Firebase
implementation 'com.github.guy-4444:SmartRateUsDialog-Android:1.00.08' // Rate us
implementation 'com.google.android.gms:play-services-ads:19.0.1' // ads
implementation project(':nativetemplates') // nativetemplates
}
My gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
// Add the Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta03'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
Related
Newest Fabric documentation says
If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL, you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will automatically be detected by the Fabric plugin.
But it's not working for me because my native code located in library module I guess. I have native code in library module and enabled Crashlytics in app module. How can I make it work?
I am using com.android.tools.build:gradle:2.3.3 and io.fabric.tools:gradle:1.23.0.
Error:
com.crashlytics.tools.android.project.codemapping.CodeMappingException: Crashlytics could not find NDK output directory '[my app module path]/obj'. Is the -androidNdkOut setting configured correctly?
UPDATE.
I moved Crashlytics configuration to my library module:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath('com.android.tools.build:gradle:2.3.3') {
force = true
}
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
publishNonDefault true
defaultConfig {
minSdkVersion 16
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
moduleName "core"
}
externalNativeBuild {
ndkBuild {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"
}
}
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
debuggable true
jniDebuggable true
minifyEnabled false
}
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
}
crashlytics {
enableNdk true
baseManifestPath '../app/src/main/AndroidManifest.xml'
}
dependencies {
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.google.android.gms:play-services-maps:${rootProject.ext.playServicesVersion}"
compile "com.google.android.gms:play-services-location:${rootProject.ext.playServicesVersion}"
}
My app module now contains only dependencies:
dependencies {
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true
}
// NDK Kit
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6#aar') {
transitive = true
}
}
But now I getting error
Could not find method baseManifestPath() for arguments [path to my Manifest] on object of type com.crashlytics.tools.gradle.CrashlyticsExtension.
I faced with same issue. I have main application module 'app' and 'library' module contains ndk sources.
Update June 2019
Last month I've been gotten an error while performing 'crashlyticsUploadSymbolsRelease' command with gradle. Seems location of libs files changed.
The following code allows me to see NDK crashes with line numbers:
crashlytics {
enableNdk true
androidNdkOut '../library/build/intermediates/cmake/release/obj'
androidNdkLibsOut '../library/build/intermediates/stripped_native_libs/release/out/lib'
}
Hope it helps.
Mike from Fabric here. That improvement will help when the NDK assets are built directly into your app, but not when building as a separate library project. When the native code is part of an external library, the project structure may differ. You’ll need to include an Ant or Gradle task to temporarily create the appropriate project structure before running the symbol upload.
Once you have assembled the appropriate project structure and you have your AndroidManifest.xml file available, you’ll need to set a few properties for the Fabric plugin to use.
Using Ant
For Ant, you should create a fabric.properties file with the following properties:
enableNDK=true
androidBaseManifest=AndroidManifest.xml
externalCSymUpload=true
Then, to run the symbol upload, invoke the crashlytics-devtools.jar which can be found inside the Ant plugin zip file. Calling java -jar crashlytics-devtools.jar -properties fabric.properties will start the upload process.
The androidBaseManifest property defines the path to the AndroidManifest.xml file with your app’s API key and package name.
Using Gradle
For Gradle, you’ll need a minimal Android build.gradle file and you can define the properties directly in a crashlytics {} block: The Fabric Gradle plugin requires the Android Gradle plugin to be applied before it in your build.gradle.
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
android {
compileSdkVersion <CURRENT COMPILESDKVERSION>
buildToolsVersion "<YOUR BUILD TOOLS VERSION>"
defaultConfig {
applicationId "<YOUR APP'S PACKAGE NAME>"
}
}
crashlytics {
enableNdk true
baseManifestPath 'AndroidManifest.xml'
}
Then run ./gradlew crashlyticsUploadSymbolsRelease to upload your symbols.
I can´t use PubNub in my Android application.
Gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:2.0.1'
compile 'com.google.android.gms:play-services-wearable:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile group: 'com.pubnub', name: 'pubnub', version: '4.0.5'
compile 'com.pubnub:pubnub:3.7.2'
}
In MainActivity.java:
import com.pubnub.api.*;
public class MainActivity extends Activity implements OnMapReadyCallback,
GoogleMap.OnMapLongClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
//...
private Pubnub pubnub; // CANNOT RESOLVE !
//...
}
How to solve this?
You have a case issue:
Pubnub should be PubNub
Also, you have two versions of PubNub SDK in there:
compile group: 'com.pubnub', name: 'pubnub', version: '4.0.5'
compile 'com.pubnub:pubnub:3.7.2'
So I would assume you are migrating from 3x to 4x and that is the reason you had the Pubnub/PubNub case issue. If you haven't seen it check out the Android V3 to Android V4 Migration Guide.
I have set up a brand new project in Android Studio 1.1 RC 1:
Created an Android project [app] (because there is no way to create an App Engine backend project right away).
Added an existing backend module by first creating a new App Engine module and then manually importing the files [backend].
Removed the Android app module [app].
Added a Java library module, same procedure, first creating a new module, then importing files [common].
Everything compiles fine, but Android Studio has two problems:
When I look at Project Structure, the [common] module is missing in the left pane, but it still appears as referenced module in the right pane!?
My Project tree looks fine and all modules are recognized, but gradle is telling me the sync failed.
Gradle says "Task '' not found in root project" ('' is empty string as it seems). I get a Warning and an exception in the log when running from Terminal, but it doesn't seem to be related (related to Indexing), so I haven't included it here.
settings.gradle has both modules specified:
include ':backend', ':common'
I tried to exchange the .iml file of the main project with a fake one which contains both modules, with the result that (besides multiple side effects) both modules were there. (I restored the original state because of the side-effects.)
Here are my gradle files:
Root module:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
allprojects {
repositories {
jcenter()
}
}
[backend]
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.17'
compile 'com.google.appengine:appengine-endpoints:1.9.17'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.17'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.1.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.jsonwebtoken:jjwt:0.4'
compile project(':common')
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
[common]
apply plugin: 'java'
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
dependencies {
compile 'com.google.http-client:google-http-client-android:1.18.0-rc'
compile 'com.google.code.gson:gson:2.3.1'
}
apply plugin: 'maven'
group = 'cc.closeup'
version = 'v2-2.0-SNAPSHOT'
install {
repositories.mavenInstaller {
pom.artifactId = 'common'
pom.packaging = 'jar'
}
}
Any ideas? Anything else that you'd like to see here?
If you want to build an AE project only. You could try this tutorial for intellij idea jetbrains.com/idea/help/creating-google-app-engine-project.html
My mistake was I removed [app]. It seems that if you create an App Engine backend module, you must keep a "fake" frontend module in the same project to keep Android Studio/gradle happy.
In earlier Android Studio versions it was possible to remove the frontend module without problems, but it seems Google has locked this somehow. It still works when I keep the fake frontend module.
--
Why I configured it this way? In my configuration, I have backend and frontend modules in different projects, and I have the backend project install libraries into local Maven, which I then pick up within my frontend project (with a team you would choose a local Maven server). This configuration has multiple advantages, for example that I can test backend/frontend on two screens simultaneously without switching back and forth all the time. Some companies may also want this configuration to keep their backend code separate and secure.
I am trying to run my gradle file with an already existing android project. The only error that I have with this application is Failed to find: com.getbase:floatingactionbutton:1.3.0. Below is my gradle file. Is there something that I need to change to get it to work?
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.getbase:floatingactionbutton:1.3.0'
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Please let me know if you require additional information. Thank you in advance!
According to a search on Maven Central at http://search.maven.org/#search%7Cga%7C1%7Cfloatingactionbutton that library exists, so I think the problem may be that you haven't added a repositories statement to your build script to let it resolve dependencies; the one you've got in the buildscript block is only to resolve build system plugins, not build dependencies. I know it's confusing. Add this block at the top level:
repositories {
mavenCentral()
}
I'm assuming also that you have a project with a flat directory structure and a single build.gradle file; when Android Studio creates projects via the wizard it uses a nested directory structure with multiple build.gradle files, and it normally adds boilerplate at the top-level build file so that you don't have to add this repositories block to each individual module's build file. If that's the case and that's in place, then this remedy won't work, so you'll have to dig deeper.
Make sure your "Global Gradle Settings" in Android Studio is NOT set for "Offline Work"
I have the CastSampleActivity set up with GoogleCastSdkAndroid, mediarouter and appcompact as dependencies, and I am able to build and launch on my phone. However no chromecast icon appears in the resulting app:
http://i.stack.imgur.com/KxMFJ.png (screenshot)
When I open activity_cast_sample.xml, I see the following:
The following classes could not be instantiated:
- android.support.v7.app.MediaRouteButton (Open Class, Show Error Log)
Which leads to a stack trace:
java.lang.NullPointerException
at com.android.layoutlib.bridge.android.BridgeContext.resolveThemeAttribute(BridgeContext.java:278)
at android.content.res.Resources_Theme_Delegate.resolveAttribute(Resources_Theme_Delegate.java:64)
at android.content.res.Resources$Theme.resolveAttribute(Resources.java:1426)
at android.support.v7.app.MediaRouterThemeHelper.isLightTheme(MediaRouterThemeHelper.java:51)
at android.support.v7.app.MediaRouterThemeHelper.createThemedContext(MediaRouterThemeHelper.java:30)
at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:121)
at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:117)
Anyone know what's going on?
This is a completely unmodified CastSampleActivity from GitHub, except for my app_id of course. I am able to cast from Youtube, Netflix, etc...
The instantiation error is normal.
Did you change the manifest or the theme settings in any way?
I had this problem too, it's incorrect project setup. Are you using Gradle? If you are, then have your build.gradle file somewhat like: (remember to put the googlecastsdk library in your libs folder)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.1+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
dependencies {
compile "com.android.support:appcompat-v7:18.0.+"
compile "com.android.support:mediarouter-v7:18.0.+"
compile files('libs/GoogleCastSdkAndroid.jar')
}