【问题标题】:how to integrate OpenCameraApp in my project as a module如何将 OpenCameraApp 作为模块集成到我的项目中
【发布时间】:2017-11-17 11:03:32
【问题描述】:

我已将This 项目作为模块集成到我的应用程序中。当我集成时,出现如下所述的错误。我有很多关于 SO 的链接,建议我降级工作室版本或升级等。关注this for adding module in my project

com.android.ide.common.process.ProcessException: Error while executing 
'E:\Softwares\sdk1\build-tools\25.0.3\llvm-rs-cc.exe' with arguments {-O 3 -
 I E:\Softwares\sdk1\build-tools\25.0.3\renderscript\include\ -I 
E:\Softwares\sdk1\build-tools\25.0.3\renderscript\clang-include\ -p D:\SVN-
WORKS\MyApplication\openCamera\build\generated\source\rs\release -o D:\SVN-
WORKS\MyApplication\openCamera\build\generated\res\rs\release\raw -target-
api 15 D:\SVN-WORKS\MyApplication\openCamera\src\main\rs\align_mtb.rs 
D:\SVN-WORKS\MyApplication\openCamera\src\main\rs\create_mtb.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\histogram_adjust.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\histogram_compute.rs D:\SVN-
WORKS\MyApplication\openCamera\src\main\rs\process_hdr.rs}

【问题讨论】:

    标签: android module project add


    【解决方案1】:

    这是您在将项目添加为另一个应用程序中的模块/库时可能遇到的困难的答案。

    关注this video tutorial 将项目添加为模块/库。

    以下是您需要考虑的几点。

    1. 将 build.gradle(library) 的第一行从“apply plugin: 'com.android.application'”更改为“apply plugin: 'com.android.library'”
    2. 从 build.gradle(library) 中移除 applicationId
    3. 确保 build.gradle(app) 和 build.gradle(library) 应该完全相同。 如下所示

    build.gradle(app)

        apply plugin: 'com.android.application'
    
        android {
          compileSdkVersion 22
          buildToolsVersion "22.0.1"
    
          defaultConfig {
             applicationId "com.xyz.xyzxyz"
             minSdkVersion 7
             targetSdkVersion 22
             versionCode 1
             versionName "1.0"
         }
        buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        }
        }
    
         dependencies {
             compile project(':openCamera')
             compile fileTree(dir: 'libs', include: ['*.jar'])
         }
    

    build.gradle(库)

    apply plugin: 'com.android.library'
    
     android {
         compileSdkVersion 22
         buildToolsVersion "22.0.1"
    
         defaultConfig {
             minSdkVersion 7
             targetSdkVersion 22
             versionCode 1
             versionName "1.0"
         }
         buildTypes {
             release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    }
    
     dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.mcxiaoke.volley:library:1.0.18'
        compile 'com.android.support:appcompat-v7:22.0.0'
     }
    
    1. 如果您的应用程序和库模块都具有 MainActivity 和 activity_main.xml 文件,则在应用程序或库中进行更改。因为您可能会在 #40(lineNumber) 等处收到 rumTime 错误,例如二进制 xml 错误。
    2. 您的 android studio 版本和项目级别的 gradle 依赖项应该具有相同的版本。就像你的工作室版本是 2.3.1 一样,dependeny 块应该有“classpath 'com.android.tools.build:gradle:2.3.1'”
    3. 最后但同样重要的是,从库的清单文件中删除库的 mainActivity 标记。代码如下所示。如果您不删除或评论它,那么您的项目中将有两个启动器,它会创建两个图标。

          <!-- Comment or delete tag to avoid two launchers in your application -->
          <intent-filter> 
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
              <category android:name="android.intent.category.DEFAULT"/>
          </intent-filter>
      

    【讨论】:

      猜你喜欢
      • 2017-10-19
      • 2015-10-17
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 2014-04-28
      • 2016-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多