如何将 OpenCameraApp 作为模块集成到我的项目中
how to integrate OpenCameraApp in my project as a module
我已经整合了This project as a module in my applictaion. When I am integrating, getting error as mentioned below. I have got so many links on SO suggesting me to downgrade studio version, or upgrade etc. Followed this for adding module in my project。
com.android.ide.common.process.ProcessException: Error while executing
'E:\Softwares\sdk1\build-tools.0.3\llvm-rs-cc.exe' with arguments {-O 3 -
I E:\Softwares\sdk1\build-tools.0.3\renderscript\include\ -I
E:\Softwares\sdk1\build-tools.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}
以下是您在另一个应用程序中将项目添加为 module/library 时可能遇到的困难的答案。
关注 this video tutorial 添加项目 module/library。
以下是您需要考虑的一些要点。
- 将 build.gradle(库)的第一行从 "apply plugin: 'com.android.application' " 更改为 "apply plugin: 'com.android.library' "
- 从 build.gradle(库)
中删除 applicationId
- 确保 build.gradle(app) 和 build.gradle(library) 应该完全相同。
如下图
build.gradle(应用程序)
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'
}
- 如果您的应用程序和库模块都有 MainActivity 和 activity_main.xml 文件,则在应用程序或库中进行更改。因为你可能会在 #40(lineNumber) 等
处得到 rumTime 错误,如二进制 xml 错误
- 您的 android 工作室版本和项目级别 gradle 依赖项应该具有相同的版本。就像你的工作室版本是 2.3.1 那么依赖块应该有“类路径 'com.android.tools.build:gradle:2.3.1' “
最后但同样重要的是,从库的清单文件中删除库的 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>
我已经整合了This project as a module in my applictaion. When I am integrating, getting error as mentioned below. I have got so many links on SO suggesting me to downgrade studio version, or upgrade etc. Followed this for adding module in my project。
com.android.ide.common.process.ProcessException: Error while executing
'E:\Softwares\sdk1\build-tools.0.3\llvm-rs-cc.exe' with arguments {-O 3 -
I E:\Softwares\sdk1\build-tools.0.3\renderscript\include\ -I
E:\Softwares\sdk1\build-tools.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}
以下是您在另一个应用程序中将项目添加为 module/library 时可能遇到的困难的答案。
关注 this video tutorial 添加项目 module/library。
以下是您需要考虑的一些要点。
- 将 build.gradle(库)的第一行从 "apply plugin: 'com.android.application' " 更改为 "apply plugin: 'com.android.library' "
- 从 build.gradle(库) 中删除 applicationId
- 确保 build.gradle(app) 和 build.gradle(library) 应该完全相同。 如下图
build.gradle(应用程序)
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'
}
- 如果您的应用程序和库模块都有 MainActivity 和 activity_main.xml 文件,则在应用程序或库中进行更改。因为你可能会在 #40(lineNumber) 等 处得到 rumTime 错误,如二进制 xml 错误
- 您的 android 工作室版本和项目级别 gradle 依赖项应该具有相同的版本。就像你的工作室版本是 2.3.1 那么依赖块应该有“类路径 'com.android.tools.build:gradle:2.3.1' “
最后但同样重要的是,从库的清单文件中删除库的 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>