Skip to content

Commit d972547

Browse files
authored
Merge branch 'master' into fix-links
2 parents fe6a02b + 4c33b94 commit d972547

File tree

128 files changed

+2090
-5079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2090
-5079
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Firebase C++ SDK issue
3+
about: Please use this template to report issues with the Firebase C++ SDK.
4+
title: ''
5+
labels: new
6+
assignees: ''
7+
8+
---
9+
10+
### Please fill in the following fields:
11+
Firebase C++ SDK version:
12+
Firebase plugins in use (Auth, Database, etc.):
13+
Additional SDKs you are using (Facebook, AdMob, etc.):
14+
Platform you are using the SDK on (Mac, Windows, or Linux):
15+
Platform you are targeting (iOS, Android, and/or desktop):
16+
17+
### Please describe the issue here:
18+
(Please list the full steps to reproduce the issue. Include device logs, and stack traces if available.)
19+
20+
### Please answer the following, if applicable:
21+
Have you been able to reproduce this issue with just the Firebase C++ quickstarts (this GitHub project)?
22+
23+
What's the issue repro rate? (eg 100%, 1/5 etc)

admob/testapp/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<uses-permission android:name="android.permission.INTERNET" />
77
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
88
<uses-permission android:name="android.permission.WAKE_LOCK" />
9-
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
9+
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
1010
<application android:label="@string/app_name">
1111
<!-- You may replace the sample Admob App ID below with your own App ID. -->
1212
<meta-data
1313
android:name="com.google.android.gms.ads.APPLICATION_ID"
14-
android:value="ca-app-pub-3940256099942544~3347511713"/>
14+
android:value="YOUR_ANDROID_ADMOB_APP_ID"/>
1515
<activity android:name="android.app.NativeActivity"
1616
android:screenOrientation="portrait"
1717
android:configChanges="orientation|screenSize">

admob/testapp/CMakeLists.txt

Lines changed: 75 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,88 +15,97 @@ if(NOT EXISTS ${FIREBASE_CPP_SDK_DIR})
1515
message(FATAL_ERROR "The Firebase C++ SDK directory does not exist: ${FIREBASE_CPP_SDK_DIR}. See the readme.md for more information")
1616
endif()
1717

18-
# Windows runtime mode, either MD or MT depending on whether you are using
19-
# /MD or /MT. For more information see:
20-
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
21-
set(MSVC_RUNTIME_MODE MD)
22-
23-
project(firebase_testapp)
24-
2518
# Sample source files.
2619
set(FIREBASE_SAMPLE_COMMON_SRCS
2720
src/main.h
2821
src/common_main.cc
2922
)
3023

31-
# Platform abstraction layer for the sample.
32-
set(FIREBASE_SAMPLE_DESKTOP_SRCS
33-
src/desktop/desktop_main.cc
34-
)
24+
# The include directory for the testapp.
25+
include_directories(src)
3526

3627
# Sample uses some features that require C++ 11, such as lambdas.
3728
set (CMAKE_CXX_STANDARD 11)
3829

39-
# Determine the path to the library based on the platform and configuration.
40-
if(APPLE)
41-
set(FIREBASE_SDK_LIBDIR ${FIREBASE_CPP_SDK_DIR}/libs/darwin/universal)
42-
set(ADDITIONAL_LIBS pthread)
43-
elseif(MSVC)
44-
if(${CMAKE_CL_64})
45-
set(MSVC_CPU x64)
46-
else()
47-
set(MSVC_CPU x86)
48-
endif()
49-
if(CMAKE_BUILD_TYPE EQUAL Release)
50-
set(MSVC_CONFIG Release)
51-
else()
52-
set(MSVC_CONFIG Debug)
53-
endif()
54-
set(MSVC_VS_VERSION VS2015)
55-
set(FIREBASE_SDK_LIBDIR
56-
${FIREBASE_CPP_SDK_DIR}/libs/windows/${MSVC_VS_VERSION}/${MSVC_RUNTIME_MODE}/${MSVC_CPU}/${MSVC_CONFIG})
30+
if(ANDROID)
31+
# Build an Android application.
32+
33+
# Source files used for the Android build.
34+
set(FIREBASE_SAMPLE_ANDROID_SRCS
35+
src/android/android_main.cc
36+
)
37+
38+
# Build native_app_glue as a static lib
39+
add_library(native_app_glue STATIC
40+
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
41+
42+
# Export ANativeActivity_onCreate(),
43+
# Refer to: https://github.com/android-ndk/ndk/issues/381.
44+
set(CMAKE_SHARED_LINKER_FLAGS
45+
"${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
46+
47+
# Define the target as a shared library, as that is what gradle expects.
48+
set(target_name "android_main")
49+
add_library(${target_name} SHARED
50+
${FIREBASE_SAMPLE_ANDROID_SRCS}
51+
${FIREBASE_SAMPLE_COMMON_SRCS}
52+
)
53+
54+
target_link_libraries(${target_name}
55+
log android atomic native_app_glue
56+
)
57+
58+
target_include_directories(${target_name} PRIVATE
59+
${ANDROID_NDK}/sources/android/native_app_glue)
60+
5761
set(ADDITIONAL_LIBS)
5862
else()
59-
# The Firebase libraries are not built with glibcxx11, so disable the ABI.
60-
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
61-
set(LINUX_CPU x86_64)
62-
set(FIREBASE_SDK_LIBDIR ${FIREBASE_CPP_SDK_DIR}/libs/linux/${LINUX_CPU})
63-
set(ADDITIONAL_LIBS pthread)
64-
endif()
63+
# Build a desktop application.
6564

66-
# Link Firebase libraries.
67-
# NOTE: firebase_app needs to be after all other Firebase libraries.
68-
link_directories(${FIREBASE_SDK_LIBDIR})
69-
set(FIREBASE_LIBS firebase_admob firebase_app)
65+
# Windows runtime mode, either MD or MT depending on whether you are using
66+
# /MD or /MT. For more information see:
67+
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
68+
set(MSVC_RUNTIME_MODE MD)
7069

71-
# Add the Firebase include directory.
72-
set(FIREBASE_SDK_INCLUDEDIR ${FIREBASE_CPP_SDK_DIR}/include)
73-
include_directories(${FIREBASE_SDK_INCLUDEDIR})
70+
# Platform abstraction layer for the desktop sample.
71+
set(FIREBASE_SAMPLE_DESKTOP_SRCS
72+
src/desktop/desktop_main.cc
73+
)
7474

75-
# The include directory for the testapp.
76-
include_directories(src)
75+
set(target_name "desktop_testapp")
76+
add_executable(${target_name}
77+
${FIREBASE_SAMPLE_DESKTOP_SRCS}
78+
${FIREBASE_SAMPLE_COMMON_SRCS}
79+
)
7780

78-
add_executable(desktop_testapp
79-
${FIREBASE_SAMPLE_DESKTOP_SRCS}
80-
${FIREBASE_SAMPLE_COMMON_SRCS}
81-
)
82-
target_link_libraries(desktop_testapp
83-
${FIREBASE_LIBS}
84-
${ADDITIONAL_LIBS}
85-
)
81+
if(APPLE)
82+
set(ADDITIONAL_LIBS pthread)
83+
elseif(MSVC)
84+
set(ADDITIONAL_LIBS)
85+
else()
86+
set(ADDITIONAL_LIBS pthread)
87+
endif()
8688

87-
# If a config file is present, copy it into the binary location so that it's
88-
# possible to create the default Firebase app.
89-
set(FOUND_JSON_FILE FALSE)
90-
foreach(config "google-services-desktop.json" "google-services.json")
91-
if (EXISTS ${config})
92-
add_custom_command(
93-
TARGET desktop_testapp POST_BUILD
94-
COMMAND ${CMAKE_COMMAND} -E copy
95-
${config} $<TARGET_FILE_DIR:desktop_testapp>)
96-
set(FOUND_JSON_FILE TRUE)
97-
break()
89+
# If a config file is present, copy it into the binary location so that it's
90+
# possible to create the default Firebase app.
91+
set(FOUND_JSON_FILE FALSE)
92+
foreach(config "google-services-desktop.json" "google-services.json")
93+
if (EXISTS ${config})
94+
add_custom_command(
95+
TARGET ${target_name} POST_BUILD
96+
COMMAND ${CMAKE_COMMAND} -E copy
97+
${config} $<TARGET_FILE_DIR:${target_name}>)
98+
set(FOUND_JSON_FILE TRUE)
99+
break()
100+
endif()
101+
endforeach()
102+
if(NOT FOUND_JSON_FILE)
103+
message(WARNING "Failed to find either google-services-desktop.json or google-services.json. See the readme.md for more information.")
98104
endif()
99-
endforeach()
100-
if(NOT FOUND_JSON_FILE)
101-
message(WARNING "Failed to find either google-services-desktop.json or google-services.json. See the readme.md for more information.")
102105
endif()
106+
107+
# Add the Firebase libraries to the target using the function from the SDK.
108+
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)
109+
# Note that firebase_app needs to be last in the list.
110+
set(firebase_libs firebase_admob firebase_app)
111+
target_link_libraries(${target_name} "${firebase_libs}" ${ADDITIONAL_LIBS})

admob/testapp/Podfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git'
22
platform :ios, '8.0'
33
# AdMob test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '5.12.0'
6-
pod 'Firebase/AdMob', '5.12.0'
5+
pod 'Firebase/AdMob', '6.16.0'
76
end

admob/testapp/build.gradle

Lines changed: 31 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.0'
9+
classpath 'com.android.tools.build:gradle:3.2.1'
1010
classpath 'com.google.gms:google-services:4.0.1'
1111
}
1212
}
@@ -21,101 +21,44 @@ allprojects {
2121

2222
apply plugin: 'com.android.application'
2323

24-
// Pre-experimental Gradle plug-in NDK boilerplate below.
25-
// Right now the Firebase plug-in does not work with the experimental
26-
// Gradle plug-in so we're using ndk-build for the moment.
27-
project.ext {
28-
// Configure the Firebase C++ SDK location.
29-
firebase_cpp_sdk_dir = System.getProperty('firebase_cpp_sdk.dir')
30-
if (firebase_cpp_sdk_dir == null || firebase_cpp_sdk_dir.isEmpty()) {
31-
firebase_cpp_sdk_dir = System.getenv('FIREBASE_CPP_SDK_DIR')
32-
if (firebase_cpp_sdk_dir == null || firebase_cpp_sdk_dir.isEmpty()) {
33-
if ((new File('firebase_cpp_sdk')).exists()) {
34-
firebase_cpp_sdk_dir = 'firebase_cpp_sdk'
35-
} else {
36-
throw new StopActionException(
37-
'firebase_cpp_sdk.dir property or the FIREBASE_CPP_SDK_DIR ' +
38-
'environment variable must be set to reference the Firebase C++ ' +
39-
'SDK install directory. This is used to configure static library ' +
40-
'and C/C++ include paths for the SDK.')
41-
}
42-
}
43-
}
44-
if (!(new File(firebase_cpp_sdk_dir)).exists()) {
45-
throw new StopActionException(
46-
sprintf('Firebase C++ SDK directory %s does not exist',
47-
firebase_cpp_sdk_dir))
48-
}
49-
// Check the NDK location using the same configuration options as the
50-
// experimental Gradle plug-in.
51-
ndk_dir = project.android.ndkDirectory
52-
if (ndk_dir == null || !ndk_dir.exists()) {
53-
ndk_dir = System.getenv('ANDROID_NDK_HOME')
54-
if (ndk_dir == null || ndk_dir.isEmpty()) {
55-
throw new StopActionException(
56-
'Android NDK directory should be specified using the ndk.dir ' +
57-
'property or ANDROID_NDK_HOME environment variable.')
58-
}
59-
}
60-
}
61-
6224
android {
63-
compileSdkVersion 26
64-
buildToolsVersion '26.0.3'
25+
compileSdkVersion 28
26+
buildToolsVersion '28.0.3'
6527

66-
sourceSets {
67-
main {
68-
jniLibs.srcDirs = ['libs']
69-
manifest.srcFile 'AndroidManifest.xml'
70-
java.srcDirs = ['src/android/java']
71-
res.srcDirs = ['res']
72-
}
28+
sourceSets {
29+
main {
30+
jniLibs.srcDirs = ['libs']
31+
manifest.srcFile 'AndroidManifest.xml'
32+
java.srcDirs = ['src/android/java']
33+
res.srcDirs = ['res']
7334
}
35+
}
7436

75-
defaultConfig {
76-
applicationId 'com.google.android.admob.testapp'
77-
minSdkVersion 14
78-
targetSdkVersion 26
79-
versionCode 1
80-
versionName '1.0'
37+
defaultConfig {
38+
applicationId 'com.google.android.admob.testapp'
39+
minSdkVersion 16
40+
targetSdkVersion 28
41+
versionCode 1
42+
versionName '1.0'
43+
externalNativeBuild.cmake {
44+
arguments "-DFIREBASE_CPP_SDK_DIR=$gradle.firebase_cpp_sdk_dir"
8145
}
82-
buildTypes {
83-
release {
84-
minifyEnabled true
85-
proguardFile getDefaultProguardFile('proguard-android.txt')
86-
proguardFile file(project.ext.firebase_cpp_sdk_dir + "/libs/android/app.pro")
87-
proguardFile file(project.ext.firebase_cpp_sdk_dir + "/libs/android/admob.pro")
88-
proguardFile file('proguard.pro')
89-
}
46+
}
47+
externalNativeBuild.cmake {
48+
path 'CMakeLists.txt'
49+
}
50+
buildTypes {
51+
release {
52+
minifyEnabled true
53+
proguardFile getDefaultProguardFile('proguard-android.txt')
54+
proguardFile file('proguard.pro')
9055
}
56+
}
9157
}
9258

93-
dependencies {
94-
compile 'com.google.firebase:firebase-core:16.0.5'
95-
compile 'com.google.firebase:firebase-ads:17.1.1'
96-
compile 'com.google.firebase:firebase-common:16.0.4'
59+
apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
60+
firebaseCpp.dependencies {
61+
admob
9762
}
9863

9964
apply plugin: 'com.google.gms.google-services'
100-
101-
task ndkBuildCompile(type:Exec) {
102-
description 'Use ndk-build to compile the C++ application.'
103-
commandLine("${project.ext.ndk_dir}${File.separator}ndk-build",
104-
"FIREBASE_CPP_SDK_DIR=${project.ext.firebase_cpp_sdk_dir}",
105-
sprintf("APP_PLATFORM=android-%d",
106-
android.defaultConfig.minSdkVersion.mApiLevel))
107-
}
108-
109-
task ndkBuildClean(type:Exec) {
110-
description 'Use ndk-build to clean the C++ application.'
111-
commandLine("${project.ext.ndk_dir}${File.separator}ndk-build",
112-
"FIREBASE_CPP_SDK_DIR=${project.ext.firebase_cpp_sdk_dir}",
113-
"clean")
114-
}
115-
116-
// Once the Android Gradle plug-in has generated tasks, add dependencies for
117-
// the ndk-build targets.
118-
project.afterEvaluate {
119-
preBuild.dependsOn(ndkBuildCompile)
120-
clean.dependsOn(ndkBuildClean)
121-
}

admob/testapp/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 commit comments

Comments
 (0)