如何在生产模式下运行react-native app?

时间:2016-07-15 23:39:28

标签: android react-native

我认为您可以使用react-native run-android --dev=false执行此操作,但执行此操作并不会阻止开发人员菜单在我摇动手机时显示,并且请求网址包含在dev=true中url params。

3 个答案:

答案 0 :(得分:3)

它位于设置选项下的开发菜单中。关键是你必须重新加载JS。您可以在打包输出中验证public class Zombie extends Entity{ Animation dwn,up, left, right; BufferedImage north, south, east, west; Sprites sprites = new Sprites(); Player player = new Player(100,100); Rectangle boundsZombie; String direction = ""; public Zombie(int x, int y){ super(x,y); sprites.create(); boundsZombie = new Rectangle(0,0, 32, 32); } public void update(){ if(player.getX() > x){ x = x + 1; } if(player.getX() < x){ x = x - 1; } if(player.getY() > y){ y = y + 1; } if(player.getY() < y){ y = y - 1; } System.out.println(player.getX()); } public Rectangle getBounds(){ return new Rectangle((int) x, (int) y, 32, 32); } public void render(Graphics g){ g.drawImage(sprites.zombieNorth, x, y, null); //g.setColor(Color.red); //g.fillRect((int) x + boundsZombie.x, (int) y + boundsZombie.y, boundsZombie.width, boundsZombie.height); } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } }

答案 1 :(得分:0)

有两种配置ReleaseDebug。默认情况下,应用程序以debug模式运行。以Release模式运行

react-native run-android --variant release #android
react-native run-ios --configuration Release #ios

查找其他可用选项

react-native run-ios -h
react-native run-android -h

答案 2 :(得分:0)

  • 您还可以使用React Native CLI生成并运行Release版本(例如react-native run-android --variant = release)。