WM23 - Android generation error - use of deprecated API July 04, 2019 10:43PM |
Registered: 5 years ago Posts: 192 |
Failure creating the Android application named <C:\Dev\Allinq\Src\Wm\Fbox\Exe\F-Box\FBox.apk>. Command Line: "C:\Program Files\Java\jdk1.8.0_131\bin\java.exe" "-Dorg.gradle.appname=C:\Dev\Allinq\Src\Wm\Fbox\Android\Gen" -classpath "C:\WINDEV Mobile 23\Personal\Android\Gradle\lib\gradle-launcher-2.14.1.jar" org.gradle.launcher.GradleMain assembleRelease -b "C:\Dev\Allinq\Src\Wm\Fbox\Android\Gen\build.gradle" Error returned: :compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). C:\Dev\Allinq\Src\Wm\Fbox\Android\Gen\src\nl\ariezona\fbox\wdgen\GWDCPGLB_Android.java:94: error: cannot find symbol import android.util.List; ^ symbol: class List location: package android.util C:\Dev\Allinq\Src\Wm\Fbox\Android\Gen\src\nl\ariezona\fbox\wdgen\GWDCPGLB_Android.java:168: error: cannot find symbol List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(downloadIntent, PackageManager.MATCH_DEFAULT_ONLY); ^ symbol: class List location: class GWDCPGLB_Android Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors :compileReleaseJavaWithJavac FAILED
import java.io.File; import android.util.List; import android.content.Intent; import android.net.Uri; import android.content.Context; import android.os.Build; import android.support.v4.content.FileProvider; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; public static void Installer(String sCheminAPK){ Intent downloadIntent; Context context = getApplicationContext(); File fileLocation = new File(context.getExternalFilesDir(null), sCheminAPK); Intent i = new Intent(); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Uri apkUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".fileProvider", fileLocation); downloadIntent = new Intent(Intent.ACTION_VIEW); downloadIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); downloadIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); downloadIntent.setDataAndType(apkUri, "application/vnd.android.package-archive"); List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(downloadIntent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; context.grantUriPermission(packageName, apkUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } } else { i.setAction(android.content.Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(new File(sCheminAPK)), "application/vnd.android.package-archive"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } getActiviteEnCours().startActivity(i); }
Re: WM23 - Android generation error - use of deprecated API July 12, 2019 12:25PM |
Registered: 5 years ago Posts: 79 |