English 中文(简体)
如何建设Collabora Anders,只作为不包含缩小规模的理论的文献浏览器?
原标题:How to build Collabora Android only as document viewer that does not include the edit mode to reduce the size?

目前,我可以在线建造科拉博拉,并把它作为另外的SDK,在我的台内打开一些文件。 但是,如果我把这一原来的建筑放在一边,规模就会太大,因此我计划消除我不需要像编辑模式那样做的特征,因为我只需要观众。 是否有可能仅仅将科拉博拉建成文件浏览器? 感谢您的帮助。

下面我试图通过改变建筑来消除不必要的资源。 校正:

apply plugin:  com.android.library 

// buildhost settings - paths and the like
apply from:  libSettings.gradle 

android {
    compileSdkVersion 33
    buildDir = "${rootProject.getBuildDir()}/lib"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"

        resValue "string", "app_name", "${liboAppName}"
        buildConfigField "String", "GIT_COMMIT", ""${liboOVersionHash}""
        buildConfigField "boolean", "GOOGLE_PLAY_ENABLED", "${liboGooglePlay}"

        externalNativeBuild {
            cmake {
                arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_STL=c++_shared"
            }
        }
    }

    splits {
        abi {
            enable true

            reset ()
            include  arm64-v8a 
        }
    }


    packagingOptions {
//        pickFirst "lib/armeabi-v7a/liblo-native-code.so"
        pickFirst "lib/arm64-v8a/liblo-native-code.so"

    }
    lintOptions {
        disable  MissingTranslation ,  ExtraTranslation 
        abortOnError false
    }

    buildTypes {
        debug {
            resValue "string", "app_name", "${liboAppName} Debug"
            debuggable true
        }
        release {
            minifyEnabled false // FIXME disabled before we get a good proguardRules for callFakeWebsocketOnMessage calling from C++
            shrinkResources false // FIXME cannot be enabled when minifyEnabled is turned off
            proguardFiles getDefaultProguardFile( proguard-android-optimize.txt ),  proguard-rules.pro 
        }
    }

    sourceSets {
        main {
            // let gradle pack the shared library into apk
            jniLibs.srcDirs = [ src/main/cpp/lib ]
        }
    }

    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
            buildStagingDirectory "${rootProject.getBuildDir()}/cmake"
        }
    }
}

dependencies {
    implementation fileTree(dir:  libs , include: [ *.jar ])

    implementation  androidx.appcompat:appcompat:1.0.2 
    implementation  com.google.android.material:material:1.1.0-alpha04 
    implementation  androidx.constraintlayout:constraintlayout:1.1.2 

}

task copyUnpackAssets(type: Copy) {
    description "copies assets that need to be extracted on the device"
    into  src/main/assets/unpack 
    into( program ) {
        from("${liboInstdir}/program/types") {
            includes = [
                    "offapi.rdb",
                    "oovbaapi.rdb"
            ]
        }
        from("${liboInstdir}/program") {
            includes = ["types.rdb"]
            rename  types.rdb ,  udkapi.rdb 
        }

        into( resource ) {
            from "${liboInstdir}/program/resource"
//            includes = [ ** ]
            includes = [ zh_TW , zh_CN ]

        }
    }
    into( etc/coolwsd ) {
        from( /android/coolkitconfig.xcu )
        includes = [  coolkitconfig.xcu  ]
    }
    into( user/fonts ) {
        from "${liboInstdir}/share/fonts/truetype"
        // Note: restrict list of fonts due to size considerations - no technical reason anymore
        // ToDo: fonts would be good candidate for using Expansion Files instead
        includes = [
                "EmojiOne*.ttf",
                "Liberation*.ttf",
                "Caladea-*.ttf",
                "Carlito-*.ttf",
                "Gen*.ttf",
                "opens___.ttf"
        ]
    }
//    into( etc/fonts ) {
//        from "${liboSrcRoot}/android/source/"
//        includes = [ fonts.conf ]
//        doFirst {
//            // we have changed the filter below; so to always re-generate this
//            // file, delete it first - no idea how to set a dependency on
//            // build.gradle changes :-(
//            file( fonts.conf ).delete()
//        }
//        filter {
//            String line ->
//                line.replaceAll(
//                     @@APPLICATION_ID@@ , new String("${liboApplicationId}")
//                )
//        }
//    }
    into( share ) {
        from "${liboInstdir}/share"
        // liblangtag data is needed for locales like en-CH
        include  liblangtag/** 
    }

//    into( share ) {
//        from "${liboInstdir}/share"
//        // extensions - for the dictionaries for hunspell
//        includes = [ extensions/dict-de/** ,  extensions/dict-en/** ,  extensions/dict-es/** ,  extensions/dict-fr/** ,  extensions/dict-pt-BR/** ]
//        exclude { FileTreeElement details ->
//            !(details.file.isDirectory() ||
//                details.file.name.endsWith( .xcu ) ||
//                details.file.name.endsWith( .dic ) ||
//                details.file.name.endsWith( .aff ) ||
//                details.file.name.endsWith( .xml ))
//        }
//    }
}

task copyAssets(type: Copy) {
    description "copies assets that can be accessed within the installed apk"
    into  src/main/assets 
//    from("${liboSrcRoot}/instdir/") {
//        includes = ["LICENSE.html", "NOTICE"]
//        rename "LICENSE.html", "license.html"
//        rename "NOTICE", "notice.txt"
//    }
//    from("${liboExampleDocument}") {
//        rename ".*", "example.odt"
//    }
    into( program ) {
        from "${liboInstdir}/program"
        includes = [ services.rdb ,  services/services.rdb ]
    }
    into( share ) {
        from "${liboInstdir}/share"
        // Filter data is needed by e.g. the drawingML preset shape import.
        includes = [ registry/** ,  filter/** ,  gallery/** ,  palette/** ]
    }
}

task createFullConfig(type: Copy) {
    description "copies various configuration bits into the apk"
    into( src/main/assets/share/config )
    from("${liboInstdir}/share/config") {
//        includes = [ soffice.cfg/** ,  images_colibre.zip ]
        includes = [ soffice.cfg/** ]

    }
}

//task copyBrandTheme(type: Copy) {
//    from "${liboBrandingDir}/online-theme"
//    into "src/main/assets/share/theme_definitions/online"
//}

//task copyDocTemplates(type: Copy) {
//    from "${rootProject.getRootDir()}/templates/untitled.odp",
//            "${rootProject.getRootDir()}/templates/untitled.ods",
//            "${rootProject.getRootDir()}/templates/untitled.odt"
//    into "src/main/assets/templates"
//}

task copyKitConfig(type: Copy) {
    from "${file(rootProject.getRootDir()).getParent()}/coolkitconfig-mobile.xcu"
    into "src/main/assets/etc/coolwsd"
    rename { "coolkitconfig.xcu" }
}

task createStrippedConfig {
    def preserveDir = file("src/main/assets/share/config/soffice.cfg/empty")
    outputs.dir "src/main/assets/share/registry/res"
    outputs.file preserveDir

    doLast {
        file( src/main/assets/share/registry/res ).mkdirs()
        file("src/main/assets/share/config/soffice.cfg").mkdirs()
        // just empty file
        preserveDir.text = ""
    }
}

task createRCfiles {
    inputs.file "libSettings.gradle"
    dependsOn copyUnpackAssets, copyAssets
    def sofficerc = file( src/main/assets/unpack/program/sofficerc )
    def fundamentalrc = file( src/main/assets/program/fundamentalrc )
    def bootstraprc = file( src/main/assets/program/bootstraprc )
    def unorc = file( src/main/assets/program/unorc )
    def lounorc = file( src/main/assets/program/lounorc )
    def versionrc = file( src/main/assets/program/versionrc )

    outputs.files sofficerc, fundamentalrc, unorc, bootstraprc, versionrc

    doLast {
        sofficerc.text =    
[Bootstrap]
Logo=1
NativeProgress=1
URE_BOOTSTRAP=file:///assets/program/fundamentalrc
HOME=$APP_DATA_DIR/cache
OSL_SOCKET_PATH=$APP_DATA_DIR/cache
   .stripIndent()

        fundamentalrc.text =    
[Bootstrap]
LO_LIB_DIR=file://$APP_DATA_DIR/lib/
BRAND_BASE_DIR=file:///assets
BRAND_SHARE_SUBDIR=share
URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
BAK_EXTENSIONS=${$ORIGIN/lounorc:TMP_EXTENSIONS}
BUNDLED_EXTENSIONS=${$ORIGIN/lounorc:BUNDLED_EXTENSIONS}
BUNDLED_EXTENSIONS_USER=${$ORIGIN/lounorc:BUNDLED_EXTENSIONS_USER}
SHARED_EXTENSIONS_USER=${$ORIGIN/lounorc:SHARED_EXTENSIONS_USER}
UNO_SHARED_PACKAGES_CACHE=${$ORIGIN/lounorc:UNO_SHARED_PACKAGES_CACHE}
TMP_EXTENSIONS=${$ORIGIN/lounorc:TMP_EXTENSIONS}
UNO_USER_PACKAGES_CACHE=${$ORIGIN/lounorc:UNO_USER_PACKAGES_CACHE}
   .stripIndent()

        bootstraprc.text =    
[Bootstrap]
InstallMode=<installmode>
ProductKey=LibreOffice     + "${liboVersionMajor}.${liboVersionMinor}" +    
UserInstallation=file://$APP_DATA_DIR
   .stripIndent()

        unorc.text =    
[Bootstrap]
URE_INTERNAL_LIB_DIR=file://$APP_DATA_DIR/lib/
UNO_TYPES=file://$APP_DATA_DIR/program/udkapi.rdb file://$APP_DATA_DIR/program/offapi.rdb file://$APP_DATA_DIR/program/oovbaapi.rdb
UNO_SERVICES=file:///assets/program/services.rdb file:///assets/program/services/services.rdb
   .stripIndent()

        lounorc.text =    
[Bootstrap]
PKG_BundledUnoFile=$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
PKG_SharedUnoFile=$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
PKG_UserUnoFile=$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
BAK_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/bak
BUNDLED_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/share/extensions
BUNDLED_EXTENSIONS_USER=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/bundled
TMP_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/tmp
SHARED_EXTENSIONS_USER=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/shared
UNO_SHARED_PACKAGES=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/share/uno_packages
UNO_SHARED_PACKAGES_CACHE=$UNO_SHARED_PACKAGES/cache
UNO_USER_PACKAGES=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/uno_packages
UNO_USER_PACKAGES_CACHE=$UNO_USER_PACKAGES/cache
   .stripIndent()

        versionrc.text =    
[Version]
AllLanguages=en-US
BuildVersion=
buildid=    + "${liboCoreVersionHash}" +    
ReferenceOOoMajorMinor=4.1
   .stripIndent()
    }
}

clean.doFirst {
    delete "src/main/assets"
    delete "src/debug/assets"
    delete "src/release/assets"
}

// creating the UI stuff is cheap, don t bother only applying it for the flavor..
preBuild.dependsOn  createRCfiles ,
         createFullConfig 
//         copyBrandTheme 

task generateCoolDebugAssets {
    doLast {
        exec {
            commandLine  make ,  -C , "${rootProject.getBuildDir()}/../../browser",  clean 
        }
        exec {
            commandLine  make ,  -C , "${rootProject.getBuildDir()}/../../browser", "DIST_FOLDER=${project.getProjectDir()}/src/debug/assets/dist",  BUNDLE=DEBUG 
        }
    }
}

task generateCoolReleaseAssets {
    doLast {
        exec {
            commandLine  make ,  -C , "${rootProject.getBuildDir()}/../../browser",  clean 
        }
        exec {
            commandLine  make ,  -C , "${rootProject.getBuildDir()}/../../browser", "DIST_FOLDER=${project.getProjectDir()}/src/release/assets/dist",  BUNDLE=RELEASE 
        }
    }
}

afterEvaluate {
//    if (!file("${liboBrandingDir}").exists()) {
//        copyBrandTheme.enabled = true
//    }
//  generateDebugAssets.dependsOn copyDocTemplates, copyKitConfig, generateCoolDebugAssets
//  generateReleaseAssets.dependsOn copyDocTemplates, copyKitConfig, generateCoolReleaseAssets
    generateDebugAssets.dependsOn copyKitConfig, generateCoolDebugAssets
    generateReleaseAssets.dependsOn copyKitConfig, generateCoolReleaseAssets
}

当我通过AAR看到时,最大的档案是校准文件,但我不知道如何缩小这一范围。 我只需要看到该文件,因此我希望,我或许可以取消编辑模式,只使用观众来减少图书馆的规模。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签