fix(android): 16k issue wip
This commit is contained in:
parent
bb72d16c5f
commit
311af6799a
5 changed files with 97 additions and 9 deletions
|
@ -170,7 +170,7 @@ configurations.all {
|
||||||
// Force Fresco/FBJNI versions with 16KB page support (or newer)
|
// Force Fresco/FBJNI versions with 16KB page support (or newer)
|
||||||
force "com.facebook.fresco:fresco:3.6.0"
|
force "com.facebook.fresco:fresco:3.6.0"
|
||||||
force "com.facebook.fresco:imagepipeline:3.6.0"
|
force "com.facebook.fresco:imagepipeline:3.6.0"
|
||||||
force "com.facebook.fresco:imagepipeline-native:3.6.0"
|
force "com.facebook.fresco:imagepipeline-base:3.6.0"
|
||||||
force "com.facebook.fresco:gifdecoder:3.6.0"
|
force "com.facebook.fresco:gifdecoder:3.6.0"
|
||||||
force "com.facebook.fresco:nativeimagetranscoder:3.6.0"
|
force "com.facebook.fresco:nativeimagetranscoder:3.6.0"
|
||||||
force "com.facebook.fresco:static-webp:3.6.0"
|
force "com.facebook.fresco:static-webp:3.6.0"
|
||||||
|
@ -184,7 +184,6 @@ configurations.all {
|
||||||
exclude group: "com.huawei.hms", module: "ucs-credential-developers"
|
exclude group: "com.huawei.hms", module: "ucs-credential-developers"
|
||||||
exclude group: "com.huawei.hms.LocationLiteSdk", module: "core"
|
exclude group: "com.huawei.hms.LocationLiteSdk", module: "core"
|
||||||
// Exclude Fresco native pipeline and webp natives to drop 0x1000 .so files
|
// Exclude Fresco native pipeline and webp natives to drop 0x1000 .so files
|
||||||
exclude group: "com.facebook.fresco", module: "imagepipeline-native"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -193,6 +192,10 @@ dependencies {
|
||||||
|
|
||||||
// Ensure Fresco core API available for app-level initialization (MainApplication)
|
// Ensure Fresco core API available for app-level initialization (MainApplication)
|
||||||
implementation("com.facebook.fresco:fresco:3.6.0")
|
implementation("com.facebook.fresco:fresco:3.6.0")
|
||||||
|
// Ensure MemoryChunkType and related API are available
|
||||||
|
implementation("com.facebook.fresco:imagepipeline-base:3.6.0")
|
||||||
|
// Include native pipeline so libimagepipeline.so is present (3.6.0 expected 16KB aligned)
|
||||||
|
implementation("com.facebook.fresco:imagepipeline-native:3.6.0")
|
||||||
|
|
||||||
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
|
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
|
||||||
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
|
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
|
||||||
|
|
|
@ -79,5 +79,10 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
|
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
|
||||||
<provider android:name="com.facebook.drawee.backends.pipeline.FrescoInitProvider" tools:node="remove"/>
|
<provider android:name="com.facebook.drawee.backends.pipeline.FrescoInitProvider" tools:node="remove"/>
|
||||||
|
<provider
|
||||||
|
android:name=".FrescoInitProvider"
|
||||||
|
android:authorities="${applicationId}.frescoinit"
|
||||||
|
android:exported="false"
|
||||||
|
android:initOrder="100" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.alertesecours
|
||||||
|
|
||||||
|
import android.content.ContentProvider
|
||||||
|
import android.content.ContentValues
|
||||||
|
import android.database.Cursor
|
||||||
|
import android.net.Uri
|
||||||
|
import com.facebook.drawee.backends.pipeline.Fresco
|
||||||
|
import com.facebook.imagepipeline.core.ImagePipelineConfig
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes Fresco as early as possible (before Application.onCreate),
|
||||||
|
* with native code disabled so no libimagepipeline.so is ever requested.
|
||||||
|
*
|
||||||
|
* This prevents crashes on devices enforcing 16KB page size when the native
|
||||||
|
* Fresco pipeline is not packaged.
|
||||||
|
*/
|
||||||
|
class FrescoInitProvider : ContentProvider() {
|
||||||
|
|
||||||
|
override fun onCreate(): Boolean {
|
||||||
|
val ctx = context ?: return false
|
||||||
|
|
||||||
|
// Use default (native) pipeline; libimagepipeline.so is now packaged (3.6.0, 16KB aligned)
|
||||||
|
val config = ImagePipelineConfig.newBuilder(ctx).build()
|
||||||
|
|
||||||
|
Fresco.initialize(ctx, config)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun query(
|
||||||
|
uri: Uri,
|
||||||
|
projection: Array<out String>?,
|
||||||
|
selection: String?,
|
||||||
|
selectionArgs: Array<out String>?,
|
||||||
|
sortOrder: String?
|
||||||
|
): Cursor? = null
|
||||||
|
|
||||||
|
override fun getType(uri: Uri): String? = null
|
||||||
|
|
||||||
|
override fun insert(uri: Uri, values: ContentValues?): Uri? = null
|
||||||
|
|
||||||
|
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int = 0
|
||||||
|
|
||||||
|
override fun update(
|
||||||
|
uri: Uri,
|
||||||
|
values: ContentValues?,
|
||||||
|
selection: String?,
|
||||||
|
selectionArgs: Array<out String>?
|
||||||
|
): Int = 0
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ class MainApplication : Application(), ReactApplication {
|
||||||
|
|
||||||
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
||||||
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,11 +46,6 @@ class MainApplication : Application(), ReactApplication {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
SoLoader.init(this, OpenSourceMergedSoMapping)
|
SoLoader.init(this, OpenSourceMergedSoMapping)
|
||||||
|
|
||||||
// Initialize Fresco to avoid native memory chunk (no libimagepipeline.so load)
|
|
||||||
val builder = ImagePipelineConfig.newBuilder(this)
|
|
||||||
builder.experiment().setNativeCodeDisabled(true)
|
|
||||||
val frescoConfig = builder.build()
|
|
||||||
Fresco.initialize(this, frescoConfig)
|
|
||||||
|
|
||||||
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||||
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
||||||
|
|
|
@ -179,7 +179,8 @@
|
||||||
D8ED2FC173D1461F87CDF597 /* Fix Xcode 15 Bug */,
|
D8ED2FC173D1461F87CDF597 /* Fix Xcode 15 Bug */,
|
||||||
F3F5A8D7A73545D78A4D8467 /* Fix Xcode 15 Bug */,
|
F3F5A8D7A73545D78A4D8467 /* Fix Xcode 15 Bug */,
|
||||||
BC7FCBEF8C354C749AB11067 /* Fix Xcode 15 Bug */,
|
BC7FCBEF8C354C749AB11067 /* Fix Xcode 15 Bug */,
|
||||||
FA5F247997BA4DDBB06F01B8 /* Remove signature files (Xcode workaround) */,
|
59A6E29E61A94EC98E5B50A7 /* Fix Xcode 15 Bug */,
|
||||||
|
822458BA69944A72BCDBEB3B /* Remove signature files (Xcode workaround) */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
|
@ -1136,6 +1137,40 @@ fi";
|
||||||
shellScript = "
|
shellScript = "
|
||||||
echo \"Remove signature files (Xcode workaround)\";
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
|
";
|
||||||
|
};
|
||||||
|
59A6E29E61A94EC98E5B50A7 /* Fix Xcode 15 Bug */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Fix Xcode 15 Bug";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||||
|
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||||
|
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||||
|
fi";
|
||||||
|
};
|
||||||
|
822458BA69944A72BCDBEB3B /* Remove signature files (Xcode workaround) */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Remove signature files (Xcode workaround)";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "
|
||||||
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
Loading…
Add table
Reference in a new issue