私の携帯電話をAndroidのnougatにアップデートして、機能の作物が突然動かない。マシュマロで完全に働いた。 これは私のbuild.gradleandroid Nougatの画像を切り取る
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "multas.com.usj.multaszgz"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':tess-two-release')
compile files('libs/androidjhlabs.jar')
//Pestañas
compile files('libs/commons-codec-1.7.jar')
compile project(path: ':openCVLibrary310')
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.android.support:design:24.2.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.itextpdf:itextg:5.5.9'
compile 'org.codepond:wizardroid:1.3.1'
compile 'com.google.android.gms:play-services:9.4.0'
testCompile 'junit:junit:4.12'
}
であり、これは、作物のためのコードです:
private void crop(){
try {
Log.v("OCRActivity", "HA LLEGADO AL CROP: "+takeStoragePermissionGranted());
File file = new File(path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(outputFileUri, "image/*");
intent.putExtra("crop", true);
//intent.putExtra("outputX",bm.getWidth());
//intent.putExtra("outputY", bm.getHeight());
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
Log.v("OCRActivity", "HA LLEGADO ");
startActivityForResult(intent, PIC_CROP);
}
catch(ActivityNotFoundException anfe){
//display an error message
String errorMessage = "Whoops - your device doesn't support the crop action!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
}catch(Exception e){
Log.e("OCRActivity", "crop():"+e.getMessage());
}
}
が、私は、コンソールにエラーを検出いけないが、それは1でなければならないときonActivityOnResultでのResultCode = 0を返します... マシュマロでうまくいかないことはわかっていません...
どれでも解決してください。
[Androidには 'CROP'' Intent'がありません](https://commonsware.com/blog/2013/01/23/no-android-does-not-have-crop-intent.html)。多くの[Android用画像トリミングライブラリ](https://android-arsenal.com/tag/45)があります。 1つを使用してください。 – CommonsWare
ありがとうございました!ですから、今私の質問は...アンドロイドのヌガーにAOSPカメラを含めることはできますか?私はこのアプリは私のために、任意の電話やユーザーのためではないので、作物のためのライブラリをインポートしたいと思います。 –
最後に私はこのカメラの.apk(http://www.qbking77.com/apps-games/download-the-camera-and-live-wallpaper-from-google-play-edition-devices/)をインストールしました。完璧でした!作物の意図については、CommonsWareに感謝します。私が見ているすべてのサイトで、情報は、camera.action.cropがアンドロイドの指示だったかのように表示されます... –