Today marks the first day that I want to fulfill my 2025 goals.
Keep the good work and let’s expect the result of this wonderful year.
Today marks the first day that I want to fulfill my 2025 goals.
Keep the good work and let’s expect the result of this wonderful year.
最簡單的步驟分享:
我算運氣不錯,只碰到了幾個問題,記下來才能避免以後又要東找西找solution囉~ =)
flavorDimensions "xxxflavor"
productFlavors {
ProductionSigned {
signingConfig android.signingConfigs.release_xxCompany
dimension "xxxflavor"
}
}
紅色兩個地方要加!意思就是至少要一個flavorDimensions,然後以後每一個product flavor裡面都要指定一個dimension才可以喔!
2. 我用到了指定apk名字的部份,這也要修改,
以前是:
variant.outputs.each { output ->
def apkName = variant.flavorName + “_” + buildType.name + “_”+variant.versionName + “_” + variant.versionCode + “.apk”;
output.outputFile = new File(output.outputFile.parent, apkName);
}
後來要改成:
variant.outputs.all {
def apkName = variant.flavorName + "_" + buildType.name + "_" +
variant.versionName + "_" + variant.versionCode + ".apk"
outputFileName = apkName
}
我遇見了這兩個問題,提供已經驗證ok過的solution給有需要的朋友參考囉~希望你們可以早點解決這一些類似的問題喔! ^___^
The info below is pretty useful, so I attached the pic here, the original source and the related link are listed as well!

The credit: https://stackoverflow.com/questions/3993924/get-android-api-level-of-phone-currently-running-my-application and the author is : birryree
2017.11.25-26 「荒野協會北五團入團集會」
這兩天真的霹靂無敵趕,星期六一大早先參加小豆的運動會表演,一結束就馬上全家飛奔到淡水參加荒野的北五團十年入團集會活動!
兩天一夜的行程有著傳承,有著對於大自然環境的承諾,有著夥伴們互相扶持的善念,互相幫助的感動,我們這一個團體,真的散播著正向的能量,為環境努力付出的毅力,以及願意持續播種在大家心靈對於環境珍惜與感恩的態度。
這一切感動著我,也敦促著我,盡一份自我的心力來影響更多的朋友們,一同為著下一代留下更健康的生活環境,以及知足惜福的生活態度,將荒野的傳承,使命,以及精神,永續下去,幫助大自然萬物,都能和平相處,相知相惜!
一同努力吧!為這兩天一夜這麼有意義的旅程,留下一個最有溫度的註記!好愛大家~!
👩👩👧👦
❤️
👨👩👧👦
2017.11.25-26 「荒野北五團十年。入團」
荷蘭兔在『何兆豐數位藝文中心』外的留影,她對小貝殼很有興趣呢! =)

大家在聆聽『何兆豐數位藝文中心』內的導覽介紹。而荷蘭兔和彩虹馬很配合的在畫畫呢~好乖巧! =)

晚餐吃飯的時間,鯊齒龍在欣賞著自己的介紹卡,彷彿和妹妹在介紹著鯊齒龍的特別之處! ^__^
晚上我們拿到了入團的領巾,這是一份傳承,希望將保護環境的毅力與決心,傳承給下一代們! =)
鯊齒龍從今天晚上(2017.11.25)晚上開始,正式的加入了北五團小蟻的行列!恭喜你!!我們一同努力保護地球! ^________^
由自然物做成的『秋之門廉』!這是鯊齒龍的創意結晶喔! ^_^


荷蘭兔也做了自己的『秋之門簾』,好開心呢! ^__^

這是『風之谷』家族的愛護地球宣言卡! =)








讓我們荒野北五團一同努力!創造永續美好的自然環境!一同加油! ^____^

如果你的Retrofit使用了OKHttp3,一定要注意這一個例外的可能性!
在okhttp的header裡面,如果你的value有非ascii的字元的話,你的程式是會crash的!這對很多人來說一定是一個坑,要多加小心喔! =)
如果已經打了fetch但是都沒有任何callback會回來,此時要注意有一種可能是因為你的google play service的版本太舊了,因為在一開始的firebase sdk中有bug,因此會造成沒有任何callback回call的現象。
更新你的firebase sdk,也更新你的google play store,即可解決這類的問題。
其實這一個功能就相對簡單許多了!
只要讀完這一個Page就能做到囉:
https://developer.android.com/training/tv/playback/options.html#background
因此關鍵就只有一件事情:
requestVisibleBehind(true)
其餘的部份都只是更完善的邏輯控制囉! =)
前提假設:
***假設你的Recommendation Service已經可以正常執行了!***
實作步驟如下:
extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, Uri.parse(BACKGROUND_URI_PREFIX + video.vCode).toString());
======
而這個『BACKGROUND_URI_PREFIX』,指的是我們要使用ContentProvider來給Android TV系統存取需要的圖片檔案,這也意味著,當我們要指定extra的時候,我們需要事先將那些圖片給下載存放好才行!
ex:
BACKGROUND_URI_PREFIX = "content://com.sample.abc.recommend/";
而『com.sample.abc.recommend』就是content provider的Authority,需要在AndoridManifest.xml中先定義好喔!
例如:
<provider android:name=".service.RecommendationsService$RecommendationBackgroundContentProvider" android:authorities="com.sample.abc.recommend" android:exported="true" />
public static class RecommendationBackgroundContentProvider extends ContentProvider {
@Override
public boolean onCreate() {
return true;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
return null;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
@Override
/*
* content provider serving files that are saved locally when recommendations are built
*/
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
String backgroundId = uri.getLastPathSegment();
File bitmapFile = getNotificationBackground(getContext(), backgroundId);
return ParcelFileDescriptor.open(bitmapFile, ParcelFileDescriptor.MODE_READ_ONLY);
}
}
private static File getNotificationBackground(Context context, String notificationId) {
return new File(context.getCacheDir(), notificationId + ".png");
}
以上,全部完成,最重要的精華和步驟說明全都附上了!希望對大家有很明顯的幫助喔! =)
相關連結:
================
The Android Support Library dependencies are now available from Google’s Maven repository at maven.google.com—instead of downloading from the Android SDK Manager.
This new distribution method simplifies Maven dependency management for those using continuous integration systems.
Two new libraries available today are: Architecture Components Library, Android Instant App Library, and we have updated Support Library to 26.0.0-beta1*.
In the future we plan to distribute all Android libraries only through maven.google.com.
From now on, the latest versions of the following libraries are available only from Google’s Maven repo (new versions are not available in the SDK Manager):
To start using Google’s Maven repository, follow these instructions to update your build dependencies.
================
The most recent versions of the following Android libraries are available from Google’s Maven repository:
To add them to your build, add maven.google.com to the Maven repositories in your module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
}
}
Then add the desired library to your dependencies block. For example, the appcompat library looks like this:
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
}
However, if you’re trying to use an older version of the above libraries and your dependency fails, then it’s not available in the Maven repository and you must instead get the library from the offline repository.
================
================
For older versions of the libraries listed above and other libraries from Google not listed above (such as Google Play services and Firebase), you must first download the offline Google Repository package from the SDK Manager.
Then you can add these libraries to your dependencies block as usual:
depedencies {
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'
}
The offline libraries are saved in android_sdk/extras/.
================
The order in which you list your dependencies indicates the priority for each: the first library is higher priority than the second, the second is higher priority than the third, and so on. This order is important in the event that resources are merged or manifest elements are merged into your app from the libraries.
For example, if your project declares the following:
LIB_A and LIB_B (in that order)LIB_A depends on LIB_C and LIB_D (in that order)LIB_B also depends on LIB_CThen, the flat dependency order will be as follows:
LIB_ALIB_DLIB_BLIB_CThis ensures that both LIB_A and LIB_B can override LIB_C; and LIB_D is still higher priority than LIB_B because LIB_A (which depends on it) has higher priority than LIB_B.
For more information about how manifests from different project sources/dependencies are merged, see Merge Multiple Manifest Files.
================
Some direct dependencies may have dependencies of their own. These are called transitive dependencies. Rather than requiring you to manually declare each transitive dependency, Gradle automatically gathers and adds them for you. To visualize both the direct and transitive dependencies of your project, the Android plugin for Gradle provides a Gradle task that generates a dependency tree for each build variant and testing source set.
To generate this report, proceed as follows:
in the tool windows bar).The following sample report shows the dependency tree for the debug build variant, and includes the local library module dependency and remote dependency from the previous example.
Executing tasks: [androidDependencies]
:app:androidDependencies
debug
/**
* Both the library module dependency and remote binary dependency are listed
* with their transitive dependencies.
*/
+--- MyApp:mylibrary:unspecified
| \--- com.android.support:appcompat-v7:25.3.1
| +--- com.android.support:animated-vector-drawable:25.3.1
| | \--- com.android.support:support-vector-drawable:25.3.1
| | \--- com.android.support:support-v4:25.3.1
| | \--- LOCAL: internal_impl-25.3.1.jar
| +--- com.android.support:support-v4:25.3.1
| | \--- LOCAL: internal_impl-25.3.1.jar
| \--- com.android.support:support-vector-drawable:25.3.1
| \--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
\--- com.android.support:appcompat-v7:25.3.1
+--- com.android.support:animated-vector-drawable:25.3.1
| \--- com.android.support:support-vector-drawable:25.3.1
| \--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
+--- com.android.support:support-v4:25.3.1
| \--- LOCAL: internal_impl-25.3.1.jar
\--- com.android.support:support-vector-drawable:25.3.1
\--- com.android.support:support-v4:25.3.1
\--- LOCAL: internal_impl-25.3.1.jar
...
For more information about managing dependencies in Gradle, see Dependency Management Basics in the Gradle User Guide.
================