

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Android &#8211; Max的程式語言筆記</title>
	<atom:link href="https://stackoverflow.max-everyday.com/tag/android/feed/" rel="self" type="application/rss+xml" />
	<link>https://stackoverflow.max-everyday.com</link>
	<description>我要當一個豬頭，快樂過每一天</description>
	<lastBuildDate>Fri, 09 Jan 2026 13:43:11 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://stackoverflow.max-everyday.com/wp-content/uploads/2017/02/max-stackoverflow-256.png</url>
	<title>Android &#8211; Max的程式語言筆記</title>
	<link>https://stackoverflow.max-everyday.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Android 15 FrameLayout 蓋住了系統欄，手動處理 視窗內邊距</title>
		<link>https://stackoverflow.max-everyday.com/2026/01/android-15-framelayout-fitssystemwindows/</link>
					<comments>https://stackoverflow.max-everyday.com/2026/01/android-15-framelayout-fitssystemwindows/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 09 Jan 2026 13:42:41 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7647</guid>

					<description><![CDATA[Android 15 強制開啟 Edge-to-...]]></description>
										<content:encoded><![CDATA[
<p>Android 15 強制開啟 Edge-to-Edge 模式。應用程式會預設填滿整個螢幕，包含狀態列與導覽列下方。如果你的 FrameLayout 蓋住了系統欄，需要手動處理 Insets（視窗內邊距）。<sup>1</sup></p>



<h2 class="wp-block-heading">使用 fitsSystemWindows</h2>



<p>這是最快的方法。在 XML 佈局中，對最外層的 FrameLayout 加入屬性：</p>



<p>XML</p>



<pre class="wp-block-code"><code>&lt;FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"&gt;
    &lt;/FrameLayout&gt;
</code></pre>



<p>這會讓系統自動幫 FrameLayout 加上內邊距，避開狀態列與導覽列。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">程式碼精確控制</h2>



<p>如果你只需要頂部避開狀態列，或是想保留背景填滿全螢幕，建議在 Activity 中使用 ViewCompat 監聽器。</p>



<p>Kotlin</p>



<pre class="wp-block-code"><code>ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.your_frame_layout)) { view, insets -&gt;
    val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
    // 根據需求設定 padding
    view.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
    insets
}
</code></pre>



<p>這段程式碼會抓取系統欄的高度。將它設為 FrameLayout 的 padding 後，內容就不會被遮擋。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">暫時停用強制規範</h2>



<p>如果你還沒準備好適應新規則，可以在 Android 15 (API 35) 的主題中加入這個屬性。但注意這只是過渡方案，未來版本可能失效。<sup>2</sup></p>



<p>在 res/values-v35/themes.xml 加入：</p>



<p>XML</p>



<pre class="wp-block-code"><code>&lt;item name="android:windowOptOutEdgeToEdgeEnforcement"&gt;true&lt;/item&gt;
</code></pre>



<p>這會讓 App 回到舊版的顯示邏輯，不再自動延伸到系統欄下方。</p>



<p><a target="_blank" rel="noreferrer noopener" href="https://www.youtube.com/watch?v=gIUe2OOzohw">Handling Edge-to-Edge in Android 15</a></p>



<p>這段影片詳細解說了 Android 15 強制全螢幕的原理，並示範如何在 Compose 和傳統 XML 中正確處理系統內邊距。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2026/01/android-15-framelayout-fitssystemwindows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>在舊的 .java 專案加入 .kt 流程</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/%e5%9c%a8%e8%88%8a%e7%9a%84-java-%e5%b0%88%e6%a1%88%e5%8a%a0%e5%85%a5-kt-%e6%b5%81%e7%a8%8b/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/%e5%9c%a8%e8%88%8a%e7%9a%84-java-%e5%b0%88%e6%a1%88%e5%8a%a0%e5%85%a5-kt-%e6%b5%81%e7%a8%8b/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 05 Dec 2025 12:48:43 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[機器學習筆記]]></category>
		<category><![CDATA[Android]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7300</guid>

					<description><![CDATA[當您在一個原本純 Java 或沒有啟用 Kotl...]]></description>
										<content:encoded><![CDATA[
<p>當您在一個原本<strong>純 Java</strong> 或<strong>沒有啟用 Kotlin 支援</strong>的 Android 專案中加入 <strong><code>.kt</code> 檔案</strong>時，編譯器可能會因為缺少必要的設定或相依性而報錯。</p>



<p>您遇到的錯誤訊息：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>&#8220;Starting in Kotlin 2.0, the Compose Compiler Gradle plugin is required when compose is enabled.&#8221;</p>
</blockquote>



<p>這表示編譯器<strong>誤以為</strong>您的專案正在使用 <strong>Jetpack Compose</strong> (Android 的現代 UI 工具包)，但缺少了 <strong>Compose Compiler 插件</strong>。</p>



<p>google 官方文件:<br><a href="https://developer.android.com/develop/ui/compose/compiler?hl=zh-tw">https://developer.android.com/develop/ui/compose/compiler?hl=zh-tw</a></p>



<p>有看沒有懂&#8230;</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 解決方案：檢查並新增 Kotlin 支援</h2>



<p>解決這個問題的關鍵是確保您的專案正確地配置了 <strong>Kotlin Android Plugin</strong> 和 <strong>Kotlin Standard Library</strong>。</p>



<h3 class="wp-block-heading">步驟 1: 檢查 Project-level 的 <code>build.gradle</code> (或 <code>settings.gradle.kts</code>)</h3>



<p>確保您的專案級別 (Project-level) 的設定檔案中，已經加入了 <strong>Kotlin Gradle Plugin</strong> 的 Classpath。</p>



<p><strong>在 <code>build.gradle</code> (Project 級別):</strong></p>



<pre class="wp-block-code"><code>buildscript {
    ext.kotlin_version = '1.9.22' // 根據您的專案需求使用最新或穩定版本
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        // ... 其他 dependencies
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // &lt;--- 確保有這行
    }
}</code></pre>



<ul class="wp-block-list">
<li><strong>注意：</strong> 如果您使用的是新的 Gradle 設定方式 (Kotlin DSL)，則應在 <strong><code>settings.gradle.kts</code></strong> 中確保有這個 Plugin。</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">步驟 2: 編輯 Module-level 的 <code>build.gradle</code> (通常是 <code>app/build.gradle</code>)</h3>



<p>這是最重要的步驟，您必須在編寫 Kotlin 程式碼的模組 (Module) 中<strong>應用 (apply)</strong> Kotlin 插件並新增必要的相依性。</p>



<p><strong>在 <code>app/build.gradle</code> (Module 級別):</strong></p>



<ol class="wp-block-list">
<li><strong>套用 Plugin (Apply Plugin):</strong> 在檔案頂部，新增 <code>kotlin-android</code> 插件。 <code>// 確保這裡有這兩行 plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' // &lt;--- 確保有這行 // 如果您的專案是純 Java 且您剛剛加入 kotlin 檔案，您可能會需要將： // apply plugin: 'com.android.application' // 改為新的 `plugins` 區塊並加入 'org.jetbrains.kotlin.android' }</code></li>



<li><strong>新增 Kotlin 標準庫 (Standard Library):</strong> 在 <code>dependencies</code> 區塊中，新增 Kotlin 標準庫。 <code>dependencies { // ... 其他 dependencies// 新增 Kotlin 標準庫相依性 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // &amp;lt;--- 確保有這行 // 如果您使用 Kotlin 與 Activity 或 Fragment 交互，建議也加入 KTX implementation "androidx.core:core-ktx:1.12.0" // 確保您使用的版本是最新的}</code></li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">步驟 3: 移除或禁用 Compose 相關設定 (如果沒有使用 Compose)</h3>



<p>如果您的專案<strong>確定沒有</strong>使用 Jetpack Compose，但錯誤訊息仍然出現，這可能是因為您在 <code>app/build.gradle</code> 中<strong>意外啟用了</strong> Compose 設定。</p>



<p><strong>請檢查 <code>android</code> 區塊：</strong></p>



<ul class="wp-block-list">
<li>尋找以下設定，如果存在且您沒有使用 Compose，請<strong>將其移除或註解掉</strong>：<br><code>gradle android { // ... buildFeatures { // 這個可能會導致錯誤，如果專案沒有使用 Compose UI compose true // &lt;--- 移除或改成 false } // ... }</code></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 最終動作</h2>



<p>完成上述步驟後，請在 Android Studio 中點擊 <strong>Sync Now</strong> (或 Gradle 檔案修改後自動出現的同步提示)，讓 Gradle 下載並應用新的設定。這樣應該就能解決編譯器報錯，並允許 Java 程式碼正確地與您的 <code>.kt</code> 檔案（例如 <code>BaseActivity.kt</code>）互動。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/%e5%9c%a8%e8%88%8a%e7%9a%84-java-%e5%b0%88%e6%a1%88%e5%8a%a0%e5%85%a5-kt-%e6%b5%81%e7%a8%8b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Android] 如何通過 Google Play 16 KB page size 要求</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-google-play-16-kb-page-size/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-google-play-16-kb-page-size/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 05 Dec 2025 09:13:43 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7298</guid>

					<description><![CDATA[遇到的錯誤是因為 OpenVPN 的啟動機制與 ...]]></description>
										<content:encoded><![CDATA[
<p>遇到的錯誤是因為 OpenVPN 的啟動機制與 <code>useLegacyPackaging = false</code> 互相衝突。</p>



<h3 class="wp-block-heading">核心原因分析</h3>



<ol start="1" class="wp-block-list">
<li>useLegacyPackaging = false 的作用：這個設定告訴 Android 建置系統（AGP），不要把 APK 裡面的 .so 檔案解壓縮到手機的 /data/app/&#8230;/lib/ 目錄下。它會讓系統直接從 APK 包裡面讀取這些函式庫（為了節省手機空間）。這就是為什麼你用 adb ls 看到目錄是空的。</li>



<li>OpenVPN (ics-openvpn) 的運作方式：Cake-VPN（以及大多數基於 ics-openvpn 的專案）並不是像一般 App 那樣只用 System.loadLibrary。它實際上是把 libovpnexec.so 當作一個可執行檔 (Executable) 來跑。Java 程式碼會嘗試去執行類似這樣的指令：/data/app/&#8230;/lib/arm64/libovpnexec.so &#8230;。因為你設了 false，檔案不存在於那個路徑上，導致 java.io.IOException，程式崩潰。</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">解決方案</h3>



<p>為了同時修復崩潰問題並通過 Google Play 的 16 KB Page Size 檢查，你需要採取<strong>兩步走</strong>的策略：</p>



<h4 class="wp-block-heading">第一步：修復崩潰（改回 True）</h4>



<p>你必須允許 Native Library 被解壓縮，因為這個 App 的架構依賴於實體檔案的存在。</p>



<p>修改 <code>build.gradle</code>：</p>



<p>Groovy</p>



<pre class="wp-block-code"><code>android {
    packaging {
        jniLibs {
            // 改回 true (或者直接刪除這段，因為預設通常是 true)
            // 這樣 Android 才會把 .so 檔解壓到 /data/app/.../lib 目錄
            useLegacyPackaging = true
        }
    }
    // ... 其他設定
}
</code></pre>



<p><em>做完這步，你的 App 就能正常啟動了，但可能還過不了 16 KB 檢查。接下來看第二步。</em></p>



<h4 class="wp-block-heading">第二步：真正解決 16 KB 對齊問題 (Rebuild NDK)</h4>



<p>既然我們必須解壓縮 <code>.so</code> 檔（<code>useLegacyPackaging = true</code>），那麼 Google Play 的要求就是：<strong>這些解壓縮出來的 ELF (.so) 檔案，其 Segment 必須是 16 KB 對齊的。</strong></p>



<p>這代表你不能只改 <code>build.gradle</code> 的 packaging 設定，你需要<strong>重新編譯 C/C++ 原始碼</strong>，並加上 Linker flags。</p>



<p>請在你的 <code>build.gradle</code> (Module level) 加入以下設定，強制 NDK 使用 16KB 對齊：</p>



<pre class="wp-block-code"><code>android {
    defaultConfig {
        // ... 其他設定
        
        externalNativeBuild {
            cmake {
                // 這是關鍵：告訴 Linker 使用 16KB (16384 bytes) 的 Page Size
                cppFlags "-Wl,-z,max-page-size=16384"
                arguments "-DANDROID_STL=c++_shared"
            }
            // 如果你是用 ndk-build (Android.mk)，則需要用不同的參數，但大多數現在都用 cmake
        }

        ndk {
            abiFilters "arm64-v8a", "x86_64"
        }
    }
}
</code></pre>



<p>注意：</p>



<p>如果你的專案不是透過 CMake 編譯（例如直接引用 libs/ 資料夾下的預編譯 .so 檔），那麼你無法透過 Gradle 修改對齊。你必須找到這些 .so 檔的原始碼重新編譯，或者尋找已經支援 16KB Alignment 的第三方庫版本。</p>



<h3 class="wp-block-heading">驗證方法</h3>



<p>修改並重新 Build 出 APK 後，請使用 Android SDK 提供的工具 <code>zipinfo</code> 或 Linux 的 <code>readelf</code> 來檢查。</p>



<ol start="1" class="wp-block-list">
<li><strong>解壓 APK</strong>，取出裡面的 <code>.so</code> 檔。</li>



<li>在終端機執行：<br><code>readelf -l libovpnexec.so | grep LOAD</code></li>



<li>檢查輸出中的 <code>Align</code> 欄位。如果是 <code>0x4000</code> (16384)，代表成功；如果是 <code>0x1000</code> (4096)，代表失敗。</li>
</ol>



<h3 class="wp-block-heading">總結</h3>



<ol start="1" class="wp-block-list">
<li>把 <code>useLegacyPackaging</code> 改回 <strong><code>true</code></strong> (讓 OpenVPN 找得到檔案)。</li>



<li>在 <code>externalNativeBuild</code> 加入 <strong><code>-Wl,-z,max-page-size=16384</code></strong> (讓編譯出來的檔案符合 Google 規範)。</li>
</ol>



<p></p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-google-play-16-kb-page-size/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Android Gradle Plugin 8+必須明確啟用 AIDL sourceSets，否則 AIDL 不會自動被編譯</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Thu, 04 Dec 2025 09:52:08 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7290</guid>

					<description><![CDATA[以下會完整告訴你 真正原因 與 如何修正，因為你...]]></description>
										<content:encoded><![CDATA[
<p>以下會完整告訴你 <strong>真正原因</strong> 與 <strong>如何修正</strong>，因為你現在遇到的狀況不是 package 錯誤，而是：</p>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>AIDL 檔雖然存在，但 Android 根本沒有編譯它</strong></h1>



<p>也就是說：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Gradle 沒把你的 vpnLib 的 AIDL 納入編譯流程 → 所以 IOpenVPNServiceInternal 永遠不會產生 → Java 當然 import 不到</strong></p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>你目前的 AIDL 檔案是正確的</strong></h1>



<p>你的檔案內容：</p>



<pre class="wp-block-code"><code>package de.blinkt.openvpn.core;
</code></pre>



<p>你的路徑：</p>



<pre class="wp-block-code"><code>vpnLib/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl
</code></pre>



<p>這是正確擺放位置，Android 應該會編譯它。</p>



<p>但它沒被編譯，原因不是 package 錯誤，而是：</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>真正原因：vpnLib 模組沒有被設定為支援 AIDL</strong></h1>



<p>在 Android Gradle Plugin 8+（對應 Android Studio 最新版本），<strong>你必須明確啟用 AIDL sourceSets</strong>，否則 AIDL 不會自動被編譯。</p>



<p>Cake-VPN 的 vpnLib 是 <strong>module library</strong>（com.android.library），預設 <strong>aidl 不會啟用</strong>。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>解決方法：在 vpnLib/build.gradle 增加 AIDL 設定</strong></h1>



<p>請在：</p>



<pre class="wp-block-code"><code>vpnLib/build.gradle
</code></pre>



<p>加入以下設定：</p>



<pre class="wp-block-code"><code>android {
    // 這行是關鍵
    buildFeatures {
        aidl true
    }

    sourceSets {
        main {
            aidl.srcDirs = &#91;'src/main/aidl']
        }
    }
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>加入後重新 build，你將會看到：</strong></h1>



<p>Android 會產生：</p>



<pre class="wp-block-code"><code>vpnLib/build/generated/aidl_source_output_dir/debug/out/de/blinkt/openvpn/core/IOpenVPNServiceInternal.java
</code></pre>



<p>然後 Java 中就可以正常 import：</p>



<pre class="wp-block-code"><code>import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2b50.png" alt="⭐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>額外注意：你的 AIDL 不完整（少兩個檔案）</strong></h1>



<p>ICS-OpenVPN 的同路徑下還有：</p>



<pre class="wp-block-code"><code>IOpenVPNStatusCallback.aidl
OpenVPNStatus.aidl
</code></pre>



<p>Cake-VPN 只放了：</p>



<pre class="wp-block-code"><code>IOpenVPNServiceInternal.aidl
</code></pre>



<p>這是不夠的。</p>



<p>你必須補齊：</p>



<h3 class="wp-block-heading">1&#x20e3; IOpenVPNStatusCallback.aidl</h3>



<h3 class="wp-block-heading">2&#x20e3; OpenVPNStatus.aidl</h3>



<p>否則 IOpenVPNServiceInternal 內的 type reference 會找不到。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-gradle-plugin-8-aidl-sourcesets/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>android 舊版 sdk 的 Manifest 控制 package 修改辧法</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Thu, 04 Dec 2025 09:16:27 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7287</guid>

					<description><![CDATA[以下用 最正確、符合 AGP 8 / Andro...]]></description>
										<content:encoded><![CDATA[
<p>以下用 <strong>最正確、符合 AGP 8 / Android SDK 34+ / Gradle 8+ 的方式</strong> 來解釋與解決你的錯誤。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" />你的錯誤訊息（重點）</h1>



<pre class="wp-block-code"><code>Incorrect package="de.blinkt.openvpn" found in source AndroidManifest.xml
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="de.blinkt.openvpn" from the source AndroidManifest.xml
</code></pre>



<p>這代表你目前使用的 Android Gradle Plugin（AGP 8.0+）已完全 <strong>不允許在每個 module 的 AndroidManifest.xml 指定 package=</strong>。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 為什麼會這樣？</h1>



<p>AGP 8 之後，Google 改成新的規則：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>AndroidManifest.xml 不能再寫 <code>package=""</code> 來定義 namespace。<br>必須在 build.gradle 中定義 <code>namespace</code>。</strong></p>
</blockquote>



<p>也就是：</p>



<h3 class="wp-block-heading">以前（舊版 SDK）</h3>



<p>Manifest 控制 package：</p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn"&gt;
</code></pre>



<h3 class="wp-block-heading">現在（SDK 34 / AGP 8）</h3>



<p>Manifest 不再允許 package<br>你需要改為：</p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<p>並且 <strong>移除</strong> Manifest 的 package 屬性。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3af.png" alt="🎯" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 正確解決方式（適用 Cake-VPN、vpnLib module）</h1>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>步驟 1：修改 vpnLib 的 <code>build.gradle</code></strong></h2>



<p>找到：</p>



<pre class="wp-block-code"><code>vpnLib/build.gradle
</code></pre>



<p>加入：</p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>步驟 2：刪除 AndroidManifest.xml 的 package</strong></h2>



<p>你的原本內容：</p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn" /&gt;
</code></pre>



<p>請改為：</p>



<pre class="wp-block-code"><code>&lt;manifest /&gt;
</code></pre>



<p>或乾脆改成：</p>



<pre class="wp-block-code"><code>&lt;manifest /&gt;
</code></pre>



<p>也沒差（因為 library module 的 manifest 通常是空的）。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 完整對照（修改前 / 修改後）</h1>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f534.png" alt="🔴" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>修改前（會報錯）</strong></h2>



<p><strong>vpnLib/src/main/AndroidManifest.xml</strong></p>



<pre class="wp-block-code"><code>&lt;manifest package="de.blinkt.openvpn"&gt;
&lt;/manifest&gt;
</code></pre>



<p><strong>vpnLib/build.gradle</strong></p>



<pre class="wp-block-code"><code>android {
    // 沒有 namespace → 錯誤
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f7e2.png" alt="🟢" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>修改後（正確，可編譯）</strong></h2>



<p><strong>vpnLib/src/main/AndroidManifest.xml</strong></p>



<pre class="wp-block-code"><code>&lt;manifest/&gt;
</code></pre>



<p><strong>vpnLib/build.gradle</strong></p>



<pre class="wp-block-code"><code>android {
    namespace "de.blinkt.openvpn"
}
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2757.png" alt="❗" class="wp-smiley" style="height: 1em; max-height: 1em;" />注意：library module 的 namespace 必須與其 Java package 一致</h1>



<p>因為 vpnLib 裡所有 Java 檔都是：</p>



<pre class="wp-block-code"><code>package de.blinkt.openvpn;
</code></pre>



<p>所以 library module namespace 必須是：</p>



<pre class="wp-block-code"><code>de.blinkt.openvpn
</code></pre>



<p>否則：</p>



<ul class="wp-block-list">
<li>R 無法對應</li>



<li>Build 會噴錯</li>



<li>依賴會錯亂</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h1 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f389.png" alt="🎉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 最終效果</h1>



<p>完成後：</p>



<ul class="wp-block-list">
<li>Gradle 不再抱怨</li>



<li>manifest 乾淨、符合 AGP 8 標準</li>



<li>R 的 namespace 正常生成</li>



<li>vpnLib 中可以使用：</li>
</ul>



<pre class="wp-block-code"><code>de.blinkt.openvpn.R.string.xxx
</code></pre>



<ul class="wp-block-list">
<li>app module 也會自動合併資源</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/android-sdk-manifest-package/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Implementation Plan &#8211; Standalone OpenVPN Integration</title>
		<link>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/</link>
					<comments>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 03 Dec 2025 07:29:34 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=7279</guid>

					<description><![CDATA[The goal is to remove th...]]></description>
										<content:encoded><![CDATA[
<p>The goal is to remove the dependency on the external &#8220;OpenVPN for Android&#8221; app and integrate the VPN connection logic directly into the current application.</p>



<h2 class="wp-block-heading" id="user-content-user-review-required">User Review Required</h2>



<p>IMPORTANT</p>



<p><strong>Library Dependency</strong>: We will use the&nbsp;<code>ics-openvpn</code>&nbsp;library (via JitPack). This is a large library that includes native code. The build time will increase, and the APK size will grow significantly (approx +10-15MB).</p>



<p>WARNING</p>



<p><strong>Manifest Merging</strong>: The&nbsp;<code>ics-openvpn</code>&nbsp;library has its own&nbsp;</p>



<p>AndroidManifest.xml. We need to ensure our&nbsp;<code>minSdk</code>&nbsp;and other attributes are compatible. The current&nbsp;<code>minSdk</code>&nbsp;is 23, which is good.</p>



<h2 class="wp-block-heading" id="user-content-proposed-changes">Proposed Changes</h2>



<h3 class="wp-block-heading" id="user-content-build-configuration">Build Configuration</h3>



<h4 class="wp-block-heading" id="user-content-modify-buildgradle">[MODIFY]&nbsp;build.gradle</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>ics-openvpn</code>&nbsp;dependency.</li>



<li>Enable&nbsp;<code>multiDex</code>&nbsp;(likely needed due to library size).</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-settingsgradle">[MODIFY]&nbsp;settings.gradle</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>jitpack.io</code>&nbsp;repository if not present (usually in project-level, but&nbsp;settings.gradle&nbsp;is common in newer Android).</li>
</ul>



<h3 class="wp-block-heading" id="user-content-core-logic">Core Logic</h3>



<h4 class="wp-block-heading" id="user-content-modify-mainactivityjava">[MODIFY]&nbsp;MainActivity.java</h4>



<ul class="wp-block-list">
<li>Remove&nbsp;check_openvpn_installed&nbsp;logic.</li>



<li>Remove&nbsp;launch_openvpn&nbsp;intent logic.</li>



<li>Remove &#8220;Install OpenVPN&#8221; UI prompts.</li>



<li>Implement&nbsp;<code>startVpnInternal()</code>:
<ul class="wp-block-list">
<li>Parse the downloaded&nbsp;<code>.ovpn</code>&nbsp;file using&nbsp;<code>ics-openvpn</code>&#8216;s&nbsp;<code>VpnProfile</code>&nbsp;parser.</li>



<li>Add the profile to&nbsp;<code>ProfileManager</code>.</li>



<li>Start the VPN service using&nbsp;<code>VPNLaunchHelper</code>&nbsp;or direct Service intent.</li>
</ul>
</li>



<li>Implement&nbsp;<code>IOpenVPNStatusCallback</code>&nbsp;to update UI (Connected/Connecting/Failed) directly from the internal service.</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-androidmanifestxml">[MODIFY]&nbsp;AndroidManifest.xml</h4>



<ul class="wp-block-list">
<li>Add&nbsp;<code>VpnService</code>&nbsp;declaration (if not automatically merged).</li>



<li>Add&nbsp;<code>BIND_VPN_SERVICE</code>&nbsp;permission.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-ui-changes">UI Changes</h3>



<h4 class="wp-block-heading" id="user-content-modify-activity_mainxml">[MODIFY]&nbsp;activity_main.xml</h4>



<ul class="wp-block-list">
<li>(Optional) Remove the &#8220;Install OpenVPN&#8221; button/banner since it&#8217;s no longer needed.</li>
</ul>



<h2 class="wp-block-heading" id="user-content-verification-plan">Verification Plan</h2>



<h3 class="wp-block-heading" id="user-content-automated-tests">Automated Tests</h3>



<ul class="wp-block-list">
<li>None available for VPN connectivity in this environment.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-manual-verification">Manual Verification</h3>



<ul class="wp-block-list">
<li><strong>Build Check</strong>: Ensure Gradle syncs and builds (I will rely on code correctness as I cannot run Gradle).</li>



<li><strong>Code Review</strong>: Verify that&nbsp;MainActivity&nbsp;correctly imports the new classes and calls the internal service instead of&nbsp;<code>startActivity</code>.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>上面是第一次的 plan, 但其實會出錯, 因為,</p>



<pre class="wp-block-code"><code> @build.gradle  > Could not resolve all files for configuration ':app:debugCompileClasspath'.
   > Could not find com.github.schwabe:ics-openvpn:0.7.9.
     Required by:
         project :app</code></pre>



<p>第2次 plan 如下:</p>



<h1 class="wp-block-heading" id="user-content-implementation-plan---integrate-local-openvpn-library">Implementation Plan &#8211; Integrate Local OpenVPN Library</h1>



<p>The goal is to remove the dependency on the external &#8220;OpenVPN for Android&#8221; app and the remote&nbsp;<code>ics-openvpn</code>&nbsp;artifact, instead using the local&nbsp;<code>vpnLib</code>&nbsp;module directly.</p>



<h2 class="wp-block-heading" id="user-content-user-review-required">User Review Required</h2>



<p>IMPORTANT</p>



<p>I will be modifying the build files to switch from a remote dependency to a local module. This assumes&nbsp;<code>vpnLib</code>&nbsp;is a complete and working copy of the OpenVPN library.</p>



<h2 class="wp-block-heading" id="user-content-proposed-changes">Proposed Changes</h2>



<h3 class="wp-block-heading" id="user-content-build-configuration">Build Configuration</h3>



<h4 class="wp-block-heading" id="user-content-modify-settingsgradle">[MODIFY]&nbsp;settings.gradle</h4>



<ul class="wp-block-list">
<li>Ensure <code>:vpnLib</code> is included in the project.</li>
</ul>



<h4 class="wp-block-heading" id="user-content-modify-appbuildgradle">[MODIFY]&nbsp;app/build.gradle</h4>



<ul class="wp-block-list">
<li>Remove <code>implementation 'com.github.schwabe:ics-openvpn:0.7.9'</code> (or similar).</li>



<li>Add <code>implementation project(':vpnLib')</code>.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-code-integration">Code Integration</h3>



<h4 class="wp-block-heading" id="user-content-modify-mainactivityjava">[MODIFY]&nbsp;MainActivity.java</h4>



<ul class="wp-block-list">
<li>Ensure imports point to the local library packages (likely <code>de.blinkt.openvpn...</code>).</li>



<li>Verify startVpnInternal and stopVpn use the local service correctly.</li>
</ul>



<h2 class="wp-block-heading" id="user-content-verification-plan">Verification Plan</h2>



<h3 class="wp-block-heading" id="user-content-automated-tests">Automated Tests</h3>



<ul class="wp-block-list">
<li>Run <code>./gradlew assembleDebug</code> to verify the build succeeds with the local dependency.</li>
</ul>



<h3 class="wp-block-heading" id="user-content-manual-verification">Manual Verification</h3>



<ul class="wp-block-list">
<li>The user will need to run the app and verify that clicking &#8220;Connect&#8221; starts the VPN process without prompting to install an external app.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2025/12/implementation-plan-standalone-openvpn-integration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Google Play 的 Data Safety（資料安全性）表單如何填，如果使用Google Admob</title>
		<link>https://stackoverflow.max-everyday.com/2022/11/google-play-data-safety-admob/</link>
					<comments>https://stackoverflow.max-everyday.com/2022/11/google-play-data-safety-admob/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Mon, 14 Nov 2022 19:20:30 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[admob]]></category>
		<category><![CDATA[Android]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=4160</guid>

					<description><![CDATA[我一開始填沒有收到，結果被退件了，呵呵，因為有使...]]></description>
										<content:encoded><![CDATA[
<p>我一開始填沒有收到，結果被退件了，呵呵，因為有使用到 Google Admob.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="980" height="624" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-3.00.28-AM.png" alt="" class="wp-image-4161" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-3.00.28-AM.png?v=1668452475 980w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-3.00.28-AM-600x382.png?v=1668452475 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/11/Screen-Shot-2022-11-15-at-3.00.28-AM-768x489.png?v=1668452475 768w" sizes="(max-width: 980px) 100vw, 980px" /></figure>



<p>英文版的Email: Action Required: Your app is not compliant with Google Play Policies</p>



<figure class="wp-block-image size-full"><img decoding="async" width="787" height="707" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2023/12/chrome_2023-12-21_11-34_6n.png?v=1703129695" alt="" class="wp-image-5213" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2023/12/chrome_2023-12-21_11-34_6n.png?v=1703129695 787w, https://stackoverflow.max-everyday.com/wp-content/uploads/2023/12/chrome_2023-12-21_11-34_6n-600x539.png?v=1703129695 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2023/12/chrome_2023-12-21_11-34_6n-768x690.png?v=1703129695 768w" sizes="(max-width: 787px) 100vw, 787px" /></figure>



<p></p>



<p></p>



<p>解法：<br><a href="https://stackoverflow.com/questions/70644513/how-to-fill-data-safety">https://stackoverflow.com/questions/70644513/how-to-fill-data-safety</a></p>



<p>Does your app collect or share any of the required user data types? Yes<br>Is all of the user data collected by your app encrypted in transit? Yes<br>Do you provide a way for users to request that their data is deleted? No</p>



<p>Location &gt; Approximate location（概略位置）<br>App activity &gt; Page views and taps in app<br>App info and performance &gt; Crash logs, Diagnostics（當機記錄、診斷資料）<br>Device or other identifiers &gt; Device or other identifiers（裝置 ID 或其他 ID）</p>



<p>Is this data collected, shared, or both? Both<br>收集：這項資料會從使用者的裝置傳出，由您 (開發人員) 或第三方接收，包括暫時處理的資料及儲存較長時間的資料。<br>分享：這項資料會轉移給使用者裝置或其他裝置上的第三方。</p>



<p>Is this data processed ephemerally? No<br>否，這項收集資料不是採暫時性方式處理</p>



<p><br>Is this data required for your app, or can users choose whether it’s collected? Data collection is required (users can’t turn off this data collection)<br>需要收集資料 (使用者無法關閉資料收集功能)</p>



<p>Why is this user data shared? Advertising or marketing<br>廣告或行銷<br>用於顯示或指定廣告/行銷通信內容，或衡量廣告成效。例如在應用程式中顯示廣告、傳送推播通知來宣傳其他產品或服務，或與廣告合作夥伴分享資料。 </p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>Prepare for Google Play&#8217;s data disclosure requirements<br><a href="https://developers.google.com/admob/android/play-data-disclosure">https://developers.google.com/admob/android/play-data-disclosure</a></p>



<h2 class="wp-block-heading" id="data_collected_and_shared_automatically">Data collected and shared automatically</h2>



<p>The Google Mobile Ads SDK collects and shares the following data types&nbsp;<em>automatically</em>&nbsp;for advertising, analytics, and fraud prevention purposes.</p>



<figure class="wp-block-table"><table><tbody><tr><th>Data</th><th>By default, the Google Mobile Ads SDK&#8230;</th></tr><tr><td>IP address</td><td>Collects device&#8217;s IP address, which may be used to estimate the general location of a device.</td></tr><tr><td>User product interactions</td><td>Collects user product interactions and interaction information, including app launch, taps, and video views.</td></tr><tr><td>Diagnostic information</td><td>Collects information related to the performance of your app and the SDK, including crash logs, app launch time, hang rate, and energy usage.</td></tr><tr><td>Device and Account identifiers</td><td>Collects&nbsp;<a href="https://support.google.com/googleplay/android-developer/answer/6048248">Android advertising (ad) ID</a>,&nbsp;<a href="https://developer.android.com/training/articles/app-set-id">app set ID</a>, and, if applicable, other identifiers related to signed-in accounts on the device.</td></tr></tbody></table></figure>



<p>All of the user data collected by Google Mobile Ads SDK is encrypted in transit using the Transport Layer Security (TLS) protocol.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>一個一個項目點, 超花時間, 請使用右上角提供的 export csv / import csv 功能:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="419" height="191" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2023/12/chrome_2023-12-21_12-05_6o.png?v=1703131572" alt="" class="wp-image-5214"/></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2022/11/google-play-data-safety-admob/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Android] Error:Execution failed for task &#8216;:processDebugManifest</title>
		<link>https://stackoverflow.max-everyday.com/2022/02/android-errorexecution-failed-for-task-processdebugmanifest/</link>
					<comments>https://stackoverflow.max-everyday.com/2022/02/android-errorexecution-failed-for-task-processdebugmanifest/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 25 Feb 2022 20:40:10 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Debug]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=4024</guid>

					<description><![CDATA[修改了程式後，Build 會失敗，錯誤訊息： E...]]></description>
										<content:encoded><![CDATA[
<p>修改了程式後，Build 會失敗，錯誤訊息：</p>



<pre class="wp-block-preformatted">Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.</pre>



<p>執行畫面：</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="301" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-1024x301.png?v=1645821215" alt="" class="wp-image-4027" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-1024x301.png?v=1645821215 1024w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-600x176.png?v=1645821215 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-768x226.png?v=1645821215 768w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-1536x451.png?v=1645821215 1536w, https://stackoverflow.max-everyday.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-26-at-4.33.17-AM-2048x601.png?v=1645821215 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>可以點下面的4組的藍色的字（Run with &#8211;stacktrace、Run with &#8211;info、&#8211;debug、Run with &#8211;scan），或微微往上捲動一點，或左下角的分類點選較高層的（上層）。就可以看到詳細的錯誤訊息。</p>



<p>例如：</p>



<pre class="wp-block-preformatted">> Task :app:processDebugMainManifest FAILED
[com.google.android.ads.consent:consent-library:1.0.8] /Users/your-app/.gradle/caches/transforms-3/2d160dafc2c9bfb6dfe1eac4c35b8ef6/transformed/jetified-consent-library-1.0.8/AndroidManifest.xml Warning:
	Package name 'com.google.android.ads.consent' used in: com.google.android.ads.consent:consent-library:1.0.8, com.google.android.ump:user-messaging-platform:1.0.0.
/Users/your-app/app/src/main/AndroidManifest.xml:13:5-94:19 Error:
	tools:replace specified at line:13 for attribute android:appComponentFactory, but no new value specified
/Users/your-app/app/src/main/AndroidManifest.xml Error:
	Validation failed, exiting
</pre>



<p>真是太神奇，第13行的 tag 裡的 attrib: tools:replace 居然會造成出錯。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2022/02/android-errorexecution-failed-for-task-processdebugmanifest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lint found fatal errors while assembling a release target</title>
		<link>https://stackoverflow.max-everyday.com/2021/10/lint-found-fatal-errors-while-assembling-a-release-target/</link>
					<comments>https://stackoverflow.max-everyday.com/2021/10/lint-found-fatal-errors-while-assembling-a-release-target/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 06 Oct 2021 12:12:32 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Debug]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=3946</guid>

					<description><![CDATA[在 Android Studio 打包程式是出現...]]></description>
										<content:encoded><![CDATA[
<p>在 Android Studio 打包程式是出現錯誤訊息：</p>



<pre class="wp-block-preformatted">Execution failed for task ':app:lintVitalRelease'.
> A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintTask$AndroidLintLauncherWorkAction
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintWorkAction
         > Lint found fatal errors while assembling a release target.</pre>



<p>執行畫面：</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM-1024x280.png?v=1633521172" alt="" class="wp-image-3948" width="840" height="229" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM-1024x280.png?v=1633521172 1024w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM-600x164.png?v=1633521172 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM-768x210.png?v=1633521172 768w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM-1536x420.png?v=1633521172 1536w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-7.50.43-PM.png?v=1633521172 1572w" sizes="auto, (max-width: 840px) 100vw, 840px" /></figure>



<p>解法：</p>



<p>實際去 build 資料夾下，並沒有 report 的資料夾，但使用 Analyze > Inspect Code  的確可以看到很多神奇的錯誤與 Warring. 逐一的修改後，就不需使用 lintOptions 來解決。</p>



<p></p>



<ol class="wp-block-list"><li>You can use&nbsp;<a href="https://developer.android.com/studio/write/lint#manuallyRunInspections">Analyze &gt; Inspect Code</a>&nbsp;menu to manually run inspections. The results appear in the&nbsp;<strong>Inspection Results</strong>&nbsp;window. This way you can view and fix the real issues.</li><li>You can still view them from&nbsp;<strong>app\build\reports\lint-results-release-fatal.html</strong>&nbsp;file without using aforementioned manual inspection menu.</li><li>Although it&#8217;s not recommended you can also suppress the lint warnings by adding below code into your&nbsp;<strong>build.gradle</strong>&nbsp;as Android Studio suggests. But keep in mind that this will not fix any real issues.</li></ol>



<pre class="wp-block-code"><code>android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
</code></pre>



<p></p>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">資料來源</h2>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2021/10/lint-found-fatal-errors-while-assembling-a-release-target/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>mission essential plugin jetbrains.android</title>
		<link>https://stackoverflow.max-everyday.com/2021/10/mission-essential-plugin-jetbrains-android/</link>
					<comments>https://stackoverflow.max-everyday.com/2021/10/mission-essential-plugin-jetbrains-android/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Wed, 06 Oct 2021 01:39:12 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Debug]]></category>
		<guid isPermaLink="false">https://stackoverflow.max-everyday.com/?p=3940</guid>

					<description><![CDATA[在 AndroidStudio 裡安裝了一個 K...]]></description>
										<content:encoded><![CDATA[
<p>在 AndroidStudio 裡安裝了一個 Kotlin 的 plugin ，重開AndroidStudio 後就掛掉了，無法進入程式，又不想重新安裝，Google 了解法，滿簡單的，刪除 disabled_plugins.txt  檔案即可。</p>



<p>錯誤的畫面：</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1024" height="637" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.27.52-AM.jpg" alt="" class="wp-image-3943" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.27.52-AM.jpg?v=1633484086 1024w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.27.52-AM-600x373.jpg?v=1633484086 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.27.52-AM-768x478.jpg?v=1633484086 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>解法：</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="646" height="334" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.35.17-AM.jpg" alt="" class="wp-image-3944" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.35.17-AM.jpg?v=1633484164 646w, https://stackoverflow.max-everyday.com/wp-content/uploads/2021/10/Screen-Shot-2021-10-06-at-9.35.17-AM-600x310.jpg?v=1633484164 600w" sizes="auto, (max-width: 646px) 100vw, 646px" /></figure>



<p>Just delete this file:</p>



<pre class="wp-block-code"><code>C:\Users\YourUserName\.AndroidStudio4.X\config\disabled_plugins.txt
</code></pre>



<p><strong>Update 10 Feb 2021:</strong></p>



<p>If you couldn&#8217;t find this address try this on windows:</p>



<pre class="wp-block-code"><code>C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudioPreview4.X\disabled_plugins.txt
</code></pre>



<p>Recently this Address transferred to here.</p>



<p><strong>Update 04 August 2021:</strong></p>



<p>If you are using windows 11 App data folder is hidden and needs to be prompted(just search how to take out missing app data folder in windows 11) Then go to the same location as earlier mentioned and delete that file</p>



<p><strong>For Linux distros</strong>, the default configuration directory is <code>~/.config/Google/AndroidStudio4.x/</code></p>



<p>So deleting&nbsp;<code>disabled_plugins.txt</code>&nbsp;will enable all of your disabled plugins and solve your problem.</p>



<pre class="wp-block-code"><code>rm ~/.config/Google/AndroidStudio4.1/disabled_plugins.txt
</code></pre>



<p><strong>For macOS</strong>, the default directory is&nbsp;<code>~/Library/Application Support/Google/AndroidStudio4.x</code></p>



<pre class="wp-block-code"><code>rm ~/Library/Application\ Support/Google/AndroidStudio4.1/disabled_plugins.txt</code></pre>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">資料來源</h2>



<p>Android Studio missing essential plugin org.jetbrains.android<br><a href="https://stackoverflow.com/questions/61682609/android-studio-missing-essential-plugin-org-jetbrains-android">https://stackoverflow.com/questions/61682609/android-studio-missing-essential-plugin-org-jetbrains-android</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2021/10/mission-essential-plugin-jetbrains-android/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
