我想为min-sdk版本19创建android应用程序。我还配置了 config.xml ,如下所示:
AFRAME.registerComponent('autoscale', {schema: {type: 'number', default: 1},
init: function () {
this.scale();this.el.addEventListener('object3dset', () => this.scale());},scale: function () {
const el = this.el;
const span = this.data;
const mesh = el.getObject3D('mesh');
if (!mesh) return;
const bbox = new THREE.Box3().setFromObject(mesh);
const scale = span / bbox.getSize().length();
var sx = this.el.getAttribute('scale').x;
var sy = this.el.getAttribute('scale').y;
var sz = this.el.getAttribute('scale').z;
var rx = this.el.getAttribute('rotation').x * (Math.PI / 180);
var ry = this.el.getAttribute('rotation').y * (Math.PI / 180);
var rz = this.el.getAttribute('rotation').z * (Math.PI / 180);
mesh.rotation.set(rx,ry,rz);
mesh.scale.set(scale*sx, scale*sy, scale*sz);
var a = new THREE.Box3().setFromObject(this.el.object3D);
var cx = (a.min.x + a.max.x)/2;
var cy = (a.min.y + a.max.y)/2;
var cz = (a.min.z + a.max.z)/2;
var posx = this.el.object3D.position.x;
var posy = this.el.object3D.position.y;
var posz = this.el.object3D.position.z;
console.log("boundingBox xyz: x: "+cx+", y: "+cy+" z: "+cz);
console.log("box position xyz: x: "+posx+", y: "+posy+" z: "+posz);
var translateX = posx - cx;
var translateY = posy - cy;
var translateZ = posz - cz;
this.el.object3DMap.mesh.translateX(translateX/sx);
this.el.object3DMap.mesh.translateY(translateY/sy);
this.el.object3DMap.mesh.translateZ(translateZ/sz);
}
});
然后在Android 4.4.4上安装了apk,它工作正常,但应用程序停止打开谷歌地图。任何人如果知道如何为Api等级19生成Apk,请帮助..
答案 0 :(得分:1)
为了更好地针对运行Android 4.4的设备优化您的应用,您应该将targetSdkVersion设置为“19”,将其安装在Android 4.4系统映像上,对其进行测试,然后使用此更改发布更新。
您可以在Android 4.4中使用API,同时也支持旧版本,方法是在执行minSdkVersion不支持的API之前,为代码添加检查系统API级别的条件。
有关详细信息,请转到https://developer.android.com/about/versions/android-4.4.html
我希望这很有帮助。